caffe安装中cmake编译出现错误

ubuntu14.04 cpu only
 
cmake -DCMAKE_BUILD_TYPE=Release -DCPU_ONLY=ON ..
 
出现错误 ,日志里是这样写的:
 
1 Determining if the pthread_create exist failed with the following output:
  2 Change Dir: /home/python/caffe-master/build/CMakeFiles/CMakeTmp
  3 
  4 Run Build Command:"/usr/bin/make" "cmTC_6dcc5/fast"
  5 /usr/bin/make -f CMakeFiles/cmTC_6dcc5.dir/build.make CMakeFiles/cmTC_6dcc5.dir/build
  6 make[1]: Entering directory '/home/python/caffe-master/build/CMakeFiles/CMakeTmp'
  7 Building C object CMakeFiles/cmTC_6dcc5.dir/CheckSymbolExists.c.o
  9 Linking C executable cmTC_6dcc5
 10 /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_6dcc5.dir/link.txt --verbose=1
 11 /usr/bin/cc       CMakeFiles/cmTC_6dcc5.dir/CheckSymbolExists.c.o  -o cmTC_6dcc5 -rdynamic
 12 CMakeFiles/cmTC_6dcc5.dir/CheckSymbolExists.c.o:在函数‘main’中:
 13 CheckSymbolExists.c:(.text+0x16):对‘pthread_create’未定义的引用
 14 collect2: error: ld returned 1 exit status
 15 CMakeFiles/cmTC_6dcc5.dir/build.make:97: recipe for target 'cmTC_6dcc5' failed
 16 make[1]: *** [cmTC_6dcc5] Error 1
 17 make[1]: Leaving directory '/home/python/caffe-master/build/CMakeFiles/CMakeTmp'
 18 Makefile:126: recipe for target 'cmTC_6dcc5/fast' failed
 21 File /home/python/caffe-master/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
 22 /* */
 25 int main(int argc, char** argv)
 26 {
 27   (void)argv;
 28 #ifndef pthread_create
 29   return ((int*)(&pthread_create))[argc];
 30 #else
 31   (void)argc;
 32   return 0;
 33 #endif
 34 }
 35 
 36 Determining if the function pthread_create exists in the pthreads failed with the following output:
 37 Change Dir: /home/python/caffe-master/build/CMakeFiles/CMakeTmp
 38 
 39 Run Build Command:"/usr/bin/make" "cmTC_773c8/fast"
 40 /usr/bin/make -f CMakeFiles/cmTC_773c8.dir/build.make CMakeFiles/cmTC_773c8.dir/build
 41 make[1]: Entering directory '/home/python/caffe-master/build/CMakeFiles/CMakeTmp'
 42 Building C object CMakeFiles/cmTC_773c8.dir/CheckFunctionExists.c.o
 43 /usr/bin/cc    -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_773c8.dir/CheckFunctionExists.c.o   -c /us    r/share/cmake-3.5/Modules/CheckFunctionExists.c
 44 Linking C executable cmTC_773c8
 45 /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_773c8.dir/link.txt --verbose=1
 46 /usr/bin/cc   -DCHECK_FUNCTION_EXISTS=pthread_create    CMakeFiles/cmTC_773c8.dir/CheckFunctionExists.c.o  -o cmTC_77    3c8 -rdynamic -lpthreads
 47 /usr/bin/ld: 找不到 -lpthreads
 48 collect2: error: ld returned 1 exit status
 49 CMakeFiles/cmTC_773c8.dir/build.make:97: recipe for target 'cmTC_773c8' failed
 50 make[1]: *** [cmTC_773c8] Error 1
 51 make[1]: Leaving directory '/home/python/caffe-master/build/CMakeFiles/CMakeTmp'
 52 Makefile:126: recipe for target 'cmTC_773c8/fast' failed
 53 make: *** [cmTC_773c8/fast] Error 2
已邀请:

tmachc

赞同来自:

请问楼主问题解决了嘛?我也遇到了该问题

Matrix

赞同来自:

碰到了同样问题,最后解了。
是不是下载的caffe2的zip包,注意目前这个包里面文件不全。
最好利用命令git clone --recursive https://github.com/caffe2/caffe2.git,把完整的目录下载到本地,下载完大概有1G左右大小,需要时间较长,耐心等待,然后再编译,就可以了,可能还会碰到其他问题,再对症下药。

要回复问题请先登录注册