NervanaSystems/ngraph

src.c:(.text+0x46): undefined reference to `pthread_create'

L-coder148 opened this issue · 1 comments

When I run cmake ../ -DNGRAPH_PYTHON_BUILD_ENABLE=ON -DNGRAPH_ONNX_IMPORT_ENABLE=ON -DNGRAPH_USE_PREBUILT_LLVM=ON on ubuntu20.04,it occurs the error.
image
and the CMakeError.log is as following

Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /mnt/e/GitHub/ngraph/build/CMakeFiles/CMakeTmp


Run Build Command(s):/usr/bin/make cmTC_e72d9/fast && /usr/bin/make  -f CMakeFiles/cmTC_e72d9.dir/build.make CMakeFiles/cmTC_e72d9.dir/build
make[1]: Entering directory '/mnt/e/GitHub/ngraph/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_e72d9.dir/src.c.o
/usr/bin/cc   -DCMAKE_HAVE_LIBC_PTHREAD -fPIE -o CMakeFiles/cmTC_e72d9.dir/src.c.o -c /mnt/e/GitHub/ngraph/build/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTC_e72d9
/usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_e72d9.dir/link.txt --verbose=1
/usr/bin/cc  -DCMAKE_HAVE_LIBC_PTHREAD  -pie -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now  CMakeFiles/cmTC_e72d9.dir/src.c.o -o cmTC_e72d9 
/usr/bin/ld: CMakeFiles/cmTC_e72d9.dir/src.c.o: in function `main':
src.c:(.text+0x46): undefined reference to `pthread_create'
/usr/bin/ld: src.c:(.text+0x52): undefined reference to `pthread_detach'
/usr/bin/ld: src.c:(.text+0x5e): undefined reference to `pthread_cancel'
/usr/bin/ld: src.c:(.text+0x6f): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_e72d9.dir/build.make:106: cmTC_e72d9] Error 1
make[1]: Leaving directory '/mnt/e/GitHub/ngraph/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:140: cmTC_e72d9/fast] Error 2

The nGraph codebase got moved into OpenVINO.
For some reason the threading library isn't being found during linking, probably related to some change in the Ubuntu 20 environment, and I think I saw something similar when I tried to build it a few months ago. I don't think there is anyone left who can merge into this repo.