MarkusEich / cpf_segmentation

Constrained Plane Fitting library for unsupervised segmentation of 3D point clouds
Apache License 2.0
81 stars 43 forks source link

make error #4

Open amiltonwong opened 7 years ago

amiltonwong commented 7 years ago

Hi, @trungtpham ,

I got the following make error. I had compiled and installed pcl 1.8.

root@milton-All-Series:/data/code/cpf_segmentation/build# make
Scanning dependencies of target segmentation
[ 14%] Building CXX object CMakeFiles/segmentation.dir/src/segmentation.cpp.o
[ 28%] Building CXX object CMakeFiles/segmentation.dir/gco-v3.0/maxflow.cpp.o
[ 42%] Building CXX object CMakeFiles/segmentation.dir/gco-v3.0/LinkedBlockList.cpp.o
[ 57%] Building CXX object CMakeFiles/segmentation.dir/gco-v3.0/GCoptimization.cpp.o
[ 71%] Building CXX object CMakeFiles/segmentation.dir/gco-v3.0/graph.cpp.o
Linking CXX shared library libsegmentation.so
[ 71%] Built target segmentation
Scanning dependencies of target segmentation_kinect_test
[ 85%] Building CXX object CMakeFiles/segmentation_kinect_test.dir/src/segmentation_kinect_test.cpp.o
Linking CXX executable segmentation_kinect_test
/usr/bin/ld: CMakeFiles/segmentation_kinect_test.dir/src/segmentation_kinect_test.cpp.o: undefined reference to symbol 'pthread_mutex_trylock@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [segmentation_kinect_test] Error 1
make[1]: *** [CMakeFiles/segmentation_kinect_test.dir/all] Error 2
make: *** [all] Error 2
root@milton-All-Series:/data/code/cpf_segmentation/build# 

Could you suggest me how to fix it?

THX~

amiltonwong commented 7 years ago

supplement: cmake log

amiltonwong commented 7 years ago

Supplement: If I comment out these two lines in CMakeLists.txt:

#add_executable (segmentation_kinect_test src/segmentation_kinect_test.cpp)
#target_link_libraries (segmentation_kinect_test ${PCL_LIBRARIES} segmentation)

I can build the package successfully:

root@milton-All-Series:/data/code2/cpf_segmentation/build# make
Scanning dependencies of target segmentation
[ 16%] Building CXX object CMakeFiles/segmentation.dir/src/segmentation.cpp.o
[ 33%] Building CXX object CMakeFiles/segmentation.dir/gco-v3.0/maxflow.cpp.o
[ 50%] Building CXX object CMakeFiles/segmentation.dir/gco-v3.0/LinkedBlockList.cpp.o
[ 66%] Building CXX object CMakeFiles/segmentation.dir/gco-v3.0/GCoptimization.cpp.o
[ 83%] Building CXX object CMakeFiles/segmentation.dir/gco-v3.0/graph.cpp.o
Linking CXX shared library libsegmentation.so
[ 83%] Built target segmentation
Scanning dependencies of target segmentation_test
[100%] Building CXX object CMakeFiles/segmentation_test.dir/src/segmentation_test.cpp.o
Linking CXX executable segmentation_test
[100%] Built target segmentation_test
trungtpham commented 7 years ago

Hi, Sorry for late reply. I guess the compilation error is due to the linking error of thread library, one reference is http://stackoverflow.com/questions/26526553/error-during-make-error-adding-symbols-dso-missing-from-command-line

Indeed, the program segmentation_kinect_test uses cloud mutex to read data from kinect sensor. That explained why the error has gone when you were not compiling segmentation_kinect_test.

Hope this helps.

Cheers, Trung

amiltonwong commented 7 years ago

Thanks @trungtpham , The solution is to: modify CMakeLists.txt line 45 as: target_link_libraries (segmentation_kinect_test ${PCL_LIBRARIES} pthread segmentation)