Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
XVilka opened this issue Dec 19, 2018 · 0 comments
Assignees

Comments

@XVilka
Copy link

XVilka commented Dec 19, 2018

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             
@topilski topilski self-assigned this Dec 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants