cmake hits undefined reference to `pthread_create'

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

cmake hits undefined reference to `pthread_create'

ag123
i made an attempt to build LibreCAD 3 from master branch
https://github.com/LibreCAD/LibreCAD_3

the git clones is well ok, but at the cmake step i got an error
Building C object CMakeFiles/cmTC_1b545.dir/CheckSymbolExists.c.o
...
/usr/bin/cc      -rdynamic CMakeFiles/cmTC_1b545.dir/CheckSymbolExists.c.o  -o cmTC_1b545 
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/cmTC_1b545.dir/CheckSymbolExists.c.o: in function `main':
CheckSymbolExists.c:(.text+0x16): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status

/* */
#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
}

i'm currently running opensuse leap 15.1 it is just recently released
and i've verified that i've installed the dependencies as given on github page as well. the dependencies give no errors after those are resolved

if i manually built the codes with cc pthreadtest.c -lpthread, it works no errors which means that pthreads library is installed
the CMakeLists.txt are apparently giving a problem.

i've even tried adding ${CMAKE_THREAD_LIBS_INIT} in all the target_link_libraries( ... ) clauses in literally all CMakeLists.txt found and i'm still getting the same error.

has anyone else encountered similar situations? this is getting pretty frustrating as cmake provides no clue as to which CMakeList and statements are causing the missing dependencies. even tried cmake --trace, and commented the last set of commands in the CMakelists.txt found in the trace but the same error persists.

cmake version 3.10.2



Reply | Threaded
Open this post in threaded view
|

Re: cmake hits undefined reference to `pthread_create'

ag123
logged issue  #219
Reply | Threaded
Open this post in threaded view
|

Re: cmake hits undefined reference to `pthread_create'

ag123
i logged the issue with cmake - kitware - the company itself
https://gitlab.kitware.com/cmake/cmake/issues/19344