compile caffe with cmake got errors!

176 views
Skip to first unread message

mjj...@gmail.com

unread,
Apr 9, 2018, 8:11:19 AM4/9/18
to Caffe Users
Hi , I have tried to compile caffe using cmake, I did as follow:
1. mkdir build
2. cd build
3. cmake ..
and then, I got error like follow:
CMake Error at cmake/Cuda.cmake:112 (string):
  string sub-command COMPARE does not recognize mode GREATER_EQUAL
Call Stack (most recent call first):
  cmake/Cuda.cmake:264 (caffe_select_nvcc_arch_flags)
  cmake/Dependencies.cmake:77 (include)
  CMakeLists.txt:46 (include)

besides,I check the CMakeError.log:
Determining if the pthread_create exist failed with the following output:
Change Dir: /home/mjj/CLionProjects/caffe_cmake/build/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec4062037407/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec4062037407.dir/build.make CMakeFiles/cmTryCompileExec4062037407.dir/build
make[1]: 正在进入目录 `/home/mjj/CLionProjects/caffe_cmake/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /home/mjj/CLionProjects/caffe_cmake/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec4062037407.dir/CheckSymbolExists.c.o
/usr/bin/cc    -o CMakeFiles/cmTryCompileExec4062037407.dir/CheckSymbolExists.c.o   -c /home/mjj/CLionProjects/caffe_cmake/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTryCompileExec4062037407
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec4062037407.dir/link.txt --verbose=1
/usr/bin/cc       CMakeFiles/cmTryCompileExec4062037407.dir/CheckSymbolExists.c.o  -o cmTryCompileExec4062037407 -rdynamic 
CMakeFiles/cmTryCompileExec4062037407.dir/CheckSymbolExists.c.o:在函数‘main’中:
CheckSymbolExists.c:(.text+0x16):对‘pthread_create’未定义的引用
collect2: error: ld returned 1 exit status
make[1]: *** [cmTryCompileExec4062037407] 错误 1
make[1]:正在离开目录 `/home/mjj/CLionProjects/caffe_cmake/build/CMakeFiles/CMakeTmp'
make: *** [cmTryCompileExec4062037407/fast] 错误 2

File /home/mjj/CLionProjects/caffe_cmake/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/mjj/CLionProjects/caffe_cmake/build/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec298938062/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec298938062.dir/build.make CMakeFiles/cmTryCompileExec298938062.dir/build
make[1]: 正在进入目录 `/home/mjj/CLionProjects/caffe_cmake/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /home/mjj/CLionProjects/caffe_cmake/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec298938062.dir/CheckFunctionExists.c.o
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTryCompileExec298938062.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-2.8/Modules/CheckFunctionExists.c
Linking C executable cmTryCompileExec298938062
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec298938062.dir/link.txt --verbose=1
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=pthread_create    CMakeFiles/cmTryCompileExec298938062.dir/CheckFunctionExists.c.o  -o cmTryCompileExec298938062 -rdynamic -lpthreads 
/usr/bin/ld: 找不到 -lpthreads
collect2: error: ld returned 1 exit status
make[1]: *** [cmTryCompileExec298938062] 错误 1
make[1]:正在离开目录 `/home/mjj/CLionProjects/caffe_cmake/build/CMakeFiles/CMakeTmp'
make: *** [cmTryCompileExec298938062/fast] 错误 2



does anyone met the same error? or anyone can help me!! thx~~~~~~~~~~

Przemek D

unread,
Apr 9, 2018, 9:59:22 AM4/9/18
to Caffe Users
See PR#6338 and this conversation. Fix is on its way.

mjj...@gmail.com

unread,
Apr 9, 2018, 10:09:31 AM4/9/18
to Caffe Users
work right!thx very much!!

在 2018年4月9日星期一 UTC+8下午9:59:22,Przemek D写道:
Reply all
Reply to author
Forward
0 new messages