SeamAwareDecimater icon indicating copy to clipboard operation
SeamAwareDecimater copied to clipboard

Build problem: "undefined reference to `pthread_create'"

Open John-Nagle opened this issue 6 years ago • 1 comments

Linking CXX executable decimater
CMakeFiles/DEC_LIBS.dir/decimate.cpp.o: In function `_ZNSt6threadC2IRKZN3igl12parallel_forImZNS1_12parallel_forImZNS1_16unique_simplicesIN5Eigen6MatrixIiLin1ELin1ELi0ELin1ELin1EEES7_NS6_IiLin1ELi1ELi0ELin1ELi1EEES8_EEvRKNS5_10MatrixBaseIT_EERNS5_15PlainObjectBaseIT0_EERNSE_IT1_EERNSE_IT2_EEEUlRmE_EEbSA_RKSF_mEUlmE_ZNS3_ImSP_EEbSA_SR_mEUlmmE0_SS_EEbSA_SR_RKSI_RKSL_mEUlmmmE_JSO_RKmSO_EEEOSA_DpOT0_':
/usr/include/c++/5/thread:137: undefined reference to `pthread_create' 

Building on Ubuntu 16.04LTS works fine until the link. Then, the above message. How can pthread_create be missing? It's a standard library function.

Link command is: cmake -E cmake_link_script CMakeFiles/decimater.dir/link.txt --verbose=

cmake version 3.11.1 gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9)

This has to be some kind of cmake problem.

John-Nagle avatar May 04 '18 18:05 John-Nagle

Looks like CMakeList.txt needs an -lpthread parameter:

target_link_libraries ( decimater
	${LIBIGL_LIBRARIES}
	-lpthread

That fixed it for me.

John-Nagle avatar May 04 '18 19:05 John-Nagle