pocl icon indicating copy to clipboard operation
pocl copied to clipboard

undefined reference to `pthread_create'

Open hysci opened this issue 3 years ago • 1 comments

Context: Debian bust, LLVM 12

Determining if the pthread_create exist failed with the following output: Change Dir: /cache01/vmshare/appdata/pocl/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_7e1c5/fast" /usr/bin/make -f CMakeFiles/cmTC_7e1c5.dir/build.make CMakeFiles/cmTC_7e1c5.dir/build make[1]: Entering directory '/cache01/vmshare/appdata/pocl/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_7e1c5.dir/CheckSymbolExists.c.o /usr/bin/cc -fPIE -o CMakeFiles/cmTC_7e1c5.dir/CheckSymbolExists.c.o -c /cache01/vmshare/appdata/pocl/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c Linking C executable cmTC_7e1c5 /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_7e1c5.dir/link.txt --verbose=1 /usr/bin/cc -rdynamic CMakeFiles/cmTC_7e1c5.dir/CheckSymbolExists.c.o -o cmTC_7e1c5 /usr/bin/ld: CMakeFiles/cmTC_7e1c5.dir/CheckSymbolExists.c.o: in function main': CheckSymbolExists.c:(.text+0x1b): undefined reference to pthread_create' collect2: error: ld returned 1 exit status make[1]: *** [CMakeFiles/cmTC_7e1c5.dir/build.make:87: cmTC_7e1c5] Error 1 make[1]: Leaving directory '/cache01/vmshare/appdata/pocl/build/CMakeFiles/CMakeTmp' make: *** [Makefile:121: cmTC_7e1c5/fast] Error 2

File /cache01/vmshare/appdata/pocl/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 }

hysci avatar Mar 08 '21 09:03 hysci

I put the source file to main.cpp, and compile with gcc -pthread main.cpp -o test, no error happens. So there is no libraries missing in my environment, but there could be something wrong with cmake files.

hysci avatar Mar 08 '21 09:03 hysci