Qihoo360 / QConf

Qihoo Distributed Configuration Management System
Other
1.87k stars 534 forks source link

cmake 报错 #90

Closed peiel closed 6 years ago

peiel commented 6 years ago
Determining if the pthread_create exist failed with the following output:
Change Dir: /home/QConf/build/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/gmake "cmTryCompileExec3630584435/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec3630584435.dir/build.make CMakeFiles/cmTryCompileExec3630584435.dir/build
gmake[1]: Entering directory `/home/QConf/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /home/QConf/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec3630584435.dir/CheckSymbolExists.c.o
/usr/bin/cc    -o CMakeFiles/cmTryCompileExec3630584435.dir/CheckSymbolExists.c.o   -c /home/QConf/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTryCompileExec3630584435
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3630584435.dir/link.txt --verbose=1
/usr/bin/cc       CMakeFiles/cmTryCompileExec3630584435.dir/CheckSymbolExists.c.o  -o cmTryCompileExec3630584435 -rdynamic 
CMakeFiles/cmTryCompileExec3630584435.dir/CheckSymbolExists.c.o: In function `main':
CheckSymbolExists.c:(.text+0xc): undefined reference to `pthread_create'
collect2: ld returned 1 exit status
gmake[1]: *** [cmTryCompileExec3630584435] Error 1
gmake[1]: Leaving directory `/home/QConf/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec3630584435/fast] Error 2

File /home/QConf/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/QConf/build/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/gmake "cmTryCompileExec2038195287/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec2038195287.dir/build.make CMakeFiles/cmTryCompileExec2038195287.dir/build
gmake[1]: Entering directory `/home/QConf/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /home/QConf/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec2038195287.dir/CheckFunctionExists.c.o
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTryCompileExec2038195287.dir/CheckFunctionExists.c.o   -c /usr/share/cmake/Modules/CheckFunctionExists.c
Linking C executable cmTryCompileExec2038195287
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec2038195287.dir/link.txt --verbose=1
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=pthread_create    CMakeFiles/cmTryCompileExec2038195287.dir/CheckFunctionExists.c.o  -o cmTryCompileExec2038195287 -rdynamic -lpthreads 
/usr/bin/ld: cannot find -lpthreads
collect2: ld returned 1 exit status
gmake[1]: *** [cmTryCompileExec2038195287] Error 1
gmake[1]: Leaving directory `/home/QConf/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec2038195287/fast] Error 2

报错提示 /usr/bin/ld: cannot find -lpthreads ,往这个方向找错误一直没有解决,解决方向错了吗?

peiel commented 6 years ago

cmake version 2.8.12.2 CentOS release 6.9 (Final)

gaodq commented 6 years ago

gcc版本是多少

peiel commented 6 years ago

@gaodq gcc (GCC) 7.1.0

peiel commented 6 years ago

把gcc版本更改为4.9.2重新cmake也是报同样的错误