Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build problem: "undefined reference to `pthread_create'" #5

Open
John-Nagle opened this issue May 4, 2018 · 1 comment
Open

Build problem: "undefined reference to `pthread_create'" #5

John-Nagle opened this issue May 4, 2018 · 1 comment

Comments

@John-Nagle
Copy link

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
Copy link
Author

Looks like CMakeList.txt needs an -lpthread parameter:

target_link_libraries ( decimater
	${LIBIGL_LIBRARIES}
	-lpthread

That fixed it for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant