8000 We need to link against threads · Issue #27 · amspath/libisyntax · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
We need to link against threads #27
Open
@jonasteuwen

Description

@jonasteuwen

If we do not, we get an error. Also it's better to set the C version to 11, not 17, doesn't work on stock ubuntu.

So, we need:

find_package(Threads REQUIRED)
...
target_link_libraries(isyntax_example libisyntax Threads::Threads)
target_link_libraries(isyntax-to-tiff PRIVATE ${TIFF_LIBRARIES} Threads::Threads)

Or it doesn't work. Error below (compiles fine if we do the above!)

jteuwen@hpc1:~/dev/libisyntax/build$ make
Scanning dependencies of target libisyntax
[  3%] Building C object CMakeFiles/libisyntax.dir/src/libisyntax.c.o
[  7%] Building C object CMakeFiles/libisyntax.dir/src/isyntax/isyntax.c.o
[ 11%] Building C object CMakeFiles/libisyntax.dir/src/isyntax/isyntax_reader.c.o
[ 14%] Building C object CMakeFiles/libisyntax.dir/src/utils/timerutils.c.o
[ 18%] Building C object CMakeFiles/libisyntax.dir/src/utils/block_allocator.c.o
[ 22%] Building C object CMakeFiles/libisyntax.dir/src/utils/benaphore.c.o
[ 25%] Building C object CMakeFiles/libisyntax.dir/src/platform/platform.c.o
[ 29%] Building C object CMakeFiles/libisyntax.dir/src/platform/work_queue.c.o
[ 33%] Building C object CMakeFiles/libisyntax.dir/src/third_party/yxml.c.o
[ 37%] Building CXX object CMakeFiles/libisyntax.dir/src/third_party/ltalloc.cc.o
[ 40%] Building C object CMakeFiles/libisyntax.dir/src/platform/linux_utils.c.o
[ 44%] Linking CXX static library liblibisyntax.a
[ 44%] Built target libisyntax
Scanning dependencies of target isyntax_example
[ 48%] Building C object CMakeFiles/isyntax_example.dir/src/isyntax_example.c.o
[ 51%] Linking CXX executable ../isyntax_example
/usr/bin/ld: liblibisyntax.a(libisyntax.c.o): in function `init_thread_pool':
libisyntax.c:(.text+0x2203): undefined reference to `pthread_create'
/usr/bin/ld: liblibisyntax.a(libisyntax.c.o): in function `worker_thread':
libisyntax.c:(.text+0x22c3): undefined reference to `sem_wait'
/usr/bin/ld: liblibisyntax.a(benaphore.c.o): in function `benaphore_create':
benaphore.c:(.text+0x40): undefined reference to `sem_open'
/usr/bin/ld: liblibisyntax.a(benaphore.c.o): in function `benaphore_destroy':
benaphore.c:(.text+0x54): undefined reference to `sem_close'
/usr/bin/ld: liblibisyntax.a(benaphore.c.o): in function `benaphore_lock':
benaphore.c:(.text+0x7c): undefined reference to `sem_wait'
/usr/bin/ld: liblibisyntax.a(benaphore.c.o): in function `benaphore_unlock':
benaphore.c:(.text+0x9c): undefined reference to `sem_post'
/usr/bin/ld: liblibisyntax.a(work_queue.c.o): in function `work_queue_create':
work_queue.c:(.text+0x2e): undefined reference to `sem_open'
/usr/bin/ld: liblibisyntax.a(work_queue.c.o): in function `work_queue_destroy':
work_queue.c:(.text+0x8e): undefined reference to `sem_close'
/usr/bin/ld: liblibisyntax.a(work_queue.c.o): in function `work_queue_submit':
work_queue.c:(.text+0x18b): undefined reference to `sem_post'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/isyntax_example.dir/build.make:104: ../isyntax_example] Error 1
make[1]: *** [CMakeFiles/Makefile2:99: CMakeFiles/isyntax_example.dir/all] Error 2
make: *** [Makefile:103: all] Error 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0