/usr/bin/ld: cannot find -lpthreads
When I cmake caffe, I run into the problem. How should I do to resolve it?
Determining if the pthread_create exist failed with the following output: Change Dir: /home/zhengwu/caffe-intel/build/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/gmake "cmTryCompileExec3412548163/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec3412548163.dir/build.make CMakeFiles/cmTryCompileExec3412548163.dir/build
gmake[1]: Entering directory /home/zhengwu/caffe-intel/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /home/zhengwu/caffe-intel/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec3412548163.dir/CheckSymbolExists.c.o
/usr/bin/cc -o CMakeFiles/cmTryCompileExec3412548163.dir/CheckSymbolExists.c.o -c /home/zhengwu/caffe-intel/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTryCompileExec3412548163
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3412548163.dir/link.txt --verbose=1
/usr/bin/cc CMakeFiles/cmTryCompileExec3412548163.dir/CheckSymbolExists.c.o -o cmTryCompileExec3412548163 -rdynamic
CMakeFiles/cmTryCompileExec3412548163.dir/CheckSymbolExists.c.o: In function main':
CheckSymbolExists.c:(.text+0x16): undefined reference to pthread_create'
collect2: error: ld returned 1 exit status
gmake[1]: *** [cmTryCompileExec3412548163] Error 1
gmake[1]: Leaving directory /home/zhengwu/caffe-intel/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec3412548163/fast] Error 2
File /home/zhengwu/caffe-intel/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/zhengwu/caffe-intel/build/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/gmake "cmTryCompileExec1193605879/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec1193605879.dir/build.make CMakeFiles/cmTryCompileExec1193605879.dir/build
gmake[1]: Entering directory /home/zhengwu/caffe-intel/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /home/zhengwu/caffe-intel/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec1193605879.dir/CheckFunctionExists.c.o
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTryCompileExec1193605879.dir/CheckFunctionExists.c.o -c /usr/share/cmake/Modules/CheckFunctionExists.c
Linking C executable cmTryCompileExec1193605879
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec1193605879.dir/link.txt --verbose=1
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTryCompileExec1193605879.dir/CheckFunctionExists.c.o -o cmTryCompileExec1193605879 -rdynamic -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
gmake[1]: *** [cmTryCompileExec1193605879] Error 1
gmake[1]: Leaving directory /home/zhengwu/caffe-intel/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec1193605879/fast] Error 2
It is more like an environment issue. Did you solve it?
Hello @wuzhijiexia , did you have any update? What's your cmake version?
close as no activity.