fastogt / fastonosql

FastoNoSQL is a crossplatform Redis, Memcached, SSDB, LevelDB, RocksDB, UnQLite, LMDB, ForestDB, Pika, Dynomite, KeyDB GUI management tool.
https://fastonosql.com
GNU General Public License v3.0
1.18k stars 96 forks source link

CMake check failing for pthread - CheckSymbolExists.c:(.text+0x16): undefined reference to `pthread_create' #71

Open XVilka opened 5 years ago

XVilka commented 5 years ago

System is Fedora 29

  1 Determining if the pthread_create exist failed with the following output:                                                                                                                                     
  2 Change Dir: /home/user/data/tools/fastonosql/build/build_linux_env/fastonosql_core/build_cmake_release/CMakeFiles/CMakeTmp                                                                                
  3                                                                                                                                                                                                               
  4 Run Build Command:"/usr/bin/ninja-build" "cmTC_549e9"                                                                                                                                                         
  5 [1/2] Building C object CMakeFiles/cmTC_549e9.dir/CheckSymbolExists.c.o                                                                                                                                       
  6 [2/2] Linking C executable cmTC_549e9                                                                                                                                                                         
  7 FAILED: cmTC_549e9                                                                                                                                                                                            
  8 : && /usr/bin/cc   -rdynamic CMakeFiles/cmTC_549e9.dir/CheckSymbolExists.c.o  -o cmTC_549e9   && :                                                                                                            
  9 /usr/bin/ld: CMakeFiles/cmTC_549e9.dir/CheckSymbolExists.c.o: in function `main':                                                                                                                             
 10 CheckSymbolExists.c:(.text+0x16): undefined reference to `pthread_create'                                                                                                                                     
 11 collect2: 错误:ld 返回 1                                                                                                                                                                                     
 12 ninja: build stopped: subcommand failed.                                                                                                                                                                      
 13                                                                                                                                                                                                               
 14 File /home/user/data/tools/fastonosql/build/build_linux_env/fastonosql_core/build_cmake_release/CMakeFiles/CMakeTmp/CheckSymbolExists.c:                                                                  
 15 /* */                                                                                                                                                                                                         
 16 #include <pthread.h>                                                                                                                                                                                          
 17                                                                                                                                                                                                               
 18 int main(int argc, char** argv)                                                                                                                                                                               
 19 {                                                                                                                                                                                                             
 20   (void)argv;                                                                                                                                                                                                 
 21 #ifndef pthread_create                                                                                                                                                                                        
 22   return ((int*)(&pthread_create))[argc];                                                                                                                                                                     
 23 #else                                                                                                                                                                                                         
 24   (void)argc;                                                                                                                                                                                                 
 25   return 0;                                                                                                                                                                                                   
 26 #endif                                                                                                                                                                                                        
 27 }                                                                                                                                                                                                             
 28                                                                                                                                                                                                               
 29 Determining if the function pthread_create exists in the pthreads failed with the following output:                                                                                                           
 30 Change Dir: /home/user/data/tools/fastonosql/build/build_linux_env/fastonosql_core/build_cmake_release/CMakeFiles/CMakeTmp                                                                                
 31                                                                                                                                                                                                               
 32 Run Build Command:"/usr/bin/ninja-build" "cmTC_15d3a"                                                                                                                                                         
 33 [1/2] Building C object CMakeFiles/cmTC_15d3a.dir/CheckFunctionExists.c.o                                                                                                                                     
 34 [2/2] Linking C executable cmTC_15d3a                                                                                                                                                                         
 35 FAILED: cmTC_15d3a                                                                                                                                                                                            
 36 : && /usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create  -rdynamic CMakeFiles/cmTC_15d3a.dir/CheckFunctionExists.c.o  -o cmTC_15d3a  -lpthreads && :                                                          
 37 /usr/bin/ld: 找不到 -lpthreads                                                                                                                                                                                
 38 collect2: 错误:ld 返回 1                                                                                                                                                                                     
 39 ninja: build stopped: subcommand failed.                                                                                                                                                                      
 40