[CMake] Determining if the function pthread_create exists in the pthreads failed with the following output:

sothy shan sothy.e98 at gmail.com
Tue Dec 15 15:09:36 EST 2015


Hello,

I am compiling the source code from
https://github.com/flowgrammable/onf2013/
My platform is
cmake version 2.8.12.2
Ubunutu 14.04

Error from CmakeError.Log  is


File /home/sothy/Téléchargements/onfc/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/sothy/Téléchargements/onfc/build/CMakeFiles/CMakeTmp

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

Can you give me suggestion how to solve the problem?

Best regards
Sothy


More information about the CMake mailing list