-
Notifications
You must be signed in to change notification settings - Fork 2k
CMakeError: /usr/bin/ld: cannot find -lpthreads #1234
Comments
Can you please share the chunk of CMake output that prints whether or not pthreads is found. Also the output of |
I have tried gcc 5.3/ 4.8.2 cmake 3.8 and -lpthread for my own pthread test case. But this error occurs and I don't know why, any ideas for this,please contact me . |
@pietern caffe is ok, but caffe2 failed. |
ubuntu@ubuntu:~/Downloads/alter/src$ make -f makefile.unix how to solve this typr of error? please give me solution.....Thanks |
Facing a similar issue with another repository - this may-or-may-not be a problem specific to caffe2. |
I fixed this issue by using the --recursive when I git clone the caffe2 repos from the github. Thanks, |
I met the similar issue and found that caffe2 code was not downloaded completely. |
Thanks @galian123 @DRyan1995 , I have fixed this issue just add --recursive when we clone caffe2. Another tips should also be noticed that glog and gflags compile error. I have configure glog OFF to around this error. Thanks . |
This issue has been solved, so I would close it . |
Met the same error , I have tried git submodule update --init --recursive , but didn't fixed it, how did you solved the problem ? Thx! |
I am also getting this error. |
hi @wincle and @JamesKBowler |
I am also getting this error. |
@DRyan1995 @galian123 I encountered timeout when cloning caffe2. Would you send the caffe2 source code package to me ? The address of my email is 850268547@qq.com, thank you. |
I encountered this error because I removed the submodule via the following steps:
|
Hi @jin-zhe - best would be to clone from https://github.com/pytorch/pytorch now. All the code should exist over there and we've updated the eigen submodule. Hope that helps. |
There are two problems here i found
@@ -163,13 +163,13 @@ else()
-if (Threads_FOUND )
-endif()
|
@xiachsh what did you change? i am not so understand? can you give me your FindThreads.cmake that you are using now? |
Isn't it the last 's' that's causing the issue |
@orionr Hi, |
@Gouiaa did you do |
@orionr I am running a project on caffe2 and I have these warnings:
|
/usr/lib64/ccache/cc CMakeFiles/cmTryCompileExec580799551.dir/CheckSymbolExists.c.o -o cmTryCompileExec580799551 -rdynamic
CMakeFiles/cmTryCompileExec580799551.dir/CheckSymbolExists.c.o: In function
main': CheckSymbolExists.c:(.text+0x16): undefined reference to
pthread_create'collect2: error: ld returned 1 exit status
gmake[2]: *** [cmTryCompileExec580799551] Error 1
gmake[2]: Leaving directory
/home/jiangbo/caffe2/build/CMakeFiles/CMakeTmp' gmake[1]: *** [cmTryCompileExec580799551/fast] Error 2 gmake[1]: Leaving directory
/home/jiangbo/caffe2/build/CMakeFiles/CMakeTmp'File /home/jiangbo/caffe2/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>
int main(int argc, char** argv)
{
(void)argv;
#ifndef pthread_create
return ((int*)(&pthread_create))[argc];
#else
(void)argc;
return 0;
#endif
}
Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/jiangbo/caffe2/build/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/gmake "cmTryCompileExec3472543844/fast"
gmake[1]: Entering directory
/home/jiangbo/caffe2/build/CMakeFiles/CMakeTmp' /usr/bin/gmake -f CMakeFiles/cmTryCompileExec3472543844.dir/build.make CMakeFiles/cmTryCompileExec3472543844.dir/build gmake[2]: Entering directory
/home/jiangbo/caffe2/build/CMakeFiles/CMakeTmp'/usr/bin/cmake -E cmake_progress_report /home/jiangbo/caffe2/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec3472543844.dir/CheckFunctionExists.c.o
/usr/lib64/ccache/cc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTryCompileExec3472543844.dir/CheckFunctionExists.c.o -c /usr/share/cmake/Modules/CheckFunctionExists.c
Linking C executable cmTryCompileExec3472543844
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3472543844.dir/link.txt --verbose=1
/usr/lib64/ccache/cc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTryCompileExec3472543844.dir/CheckFunctionExists.c.o -o cmTryCompileExec3472543844 -rdynamic -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
gmake[2]: *** [cmTryCompileExec3472543844] Error 1
gmake[2]: Leaving directory
/home/jiangbo/caffe2/build/CMakeFiles/CMakeTmp' gmake[1]: *** [cmTryCompileExec3472543844/fast] Error 2 gmake[1]: Leaving directory
/home/jiangbo/caffe2/build/CMakeFiles/CMakeTmp'Performing C++ SOURCE FILE Test CAFFE2_NEED_TO_TURN_OFF_DEPRECATION_WARNING failed with the following output:
Change Dir: /home/jiangbo/caffe2/build/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/gmake "cmTryCompileExec1218977336/fast"
gmake[1]: Entering directory
/home/jiangbo/caffe2/build/CMakeFiles/CMakeTmp' /usr/bin/gmake -f CMakeFiles/cmTryCompileExec1218977336.dir/build.make CMakeFiles/cmTryCompileExec1218977336.dir/build gmake[2]: Entering directory
/home/jiangbo/caffe2/build/CMakeFiles/CMakeTmp'/usr/bin/cmake -E cmake_progress_report /home/jiangbo/caffe2/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object CMakeFiles/cmTryCompileExec1218977336.dir/src.cxx.o
/usr/lib64/ccache/c++ -fopenmp -DCAFFE2_NEED_TO_TURN_OFF_DEPRECATION_WARNING -std=c++11 -o CMakeFiles/cmTryCompileExec1218977336.dir/src.cxx.o -c /home/jiangbo/caffe2/build/CMakeFiles/CMakeTmp/src.cxx
In file included from /usr/include/c++/4.8.2/ext/hash_set:60:0
.....
I use ldconfig -h | grep pthread can find the library, libpthreads. Google this problem, may be some error in the code if i use cmake 3.8 version. ## please tell me where to change -lptheads to -lpthread.
The text was updated successfully, but these errors were encountered: