hku-mars/ikd-Tree

undefined references to `pthread_mutex_trylock'

2848385707 opened this issue · 4 comments

when I use 'make -j 9',the error is found ,"undefined references to `pthread_mutex_trylock'" follow ,I use pcl-1.10.

@2848385707
Please update to the latest commit since there were lots of changes in process tonight. If the error appears again, please provide more details (i.e., screenshots or logs)

@2848385707 Please update to the latest commit since there were lots of changes in process tonight. If the error appears again, please provide more details (i.e., screenshots or logs)
Thank you,this is my error:
[
/usr/bin/ld: CMakeFiles/ikd_tree_Search_demo.dir/ikd_Tree/ikd_Tree.cpp.o: undefined reference to symbol 'pthread_mutex_trylock@@GLIBC_2.2.5'
/usr/bin/ld: /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
/usr/bin/ld: CMakeFiles/ikd_tree_async_demo.dir/ikd_Tree/ikd_Tree.cpp.o: undefined reference to symbol 'pthread_mutex_trylock@@GLIBC_2.2.5'
/usr/bin/ld: /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
]
I use ubuntu20.04

@2848385707

It seems that you should make a small modification in the CMakelists.txt.
Try to change Line 6 set(CMAKE_CXX_FLAGS "-std=c++11 -O3") to set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread -O3") .

Both the old cmakelists and the change above work on my PC. If it also works for you, I will update the cmakelists .

@2848385707

It seems that you should make a small modification in the CMakelists.txt. Try to change Line 6 set(CMAKE_CXX_FLAGS "-std=c++11 -O3") to set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread -O3") .

Both the old cmakelists and the change above work on my PC. If it also works for you, I will update the cmakelists .

Thank you very much. The compilation was successful!