DeepGraphLearning / graphvite

GraphVite: A General and High-performance Graph Embedding System
https://graphvite.io
Apache License 2.0
1.22k stars 151 forks source link

Installation error: cmake error /usr/bin/ld: cannot find -lpthreads #38

Open Jappy0 opened 4 years ago

Jappy0 commented 4 years ago

Hi, could you help me fix this bug when I was installing graphvite on my computer...? I have tried using cmake version 3.14 and 3.16.2. The CMakeError.log is presented as follows. Thanks~

CMakeError.log

Determining if the pthread_create exist failed with the following output: Change Dir: /home/ppy/Repos/graphvite/build/CMakeFiles/CMakeTmp

Run Build Command(s):/home/ppy/anaconda3/bin/make cmTC_632ad/fast /home/ppy/anaconda3/bin/make -f CMakeFiles/cmTC_632ad.dir/build.make CMakeFiles/cmTC_632ad.dir/build make[1]: Entering directory '/home/ppy/Repos/graphvite/build/CMakeFiles/CMakeTmp' Building CXX object CMakeFiles/cmTC_632ad.dir/CheckSymbolExists.cxx.o /usr/bin/c++ -o CMakeFiles/cmTC_632ad.dir/CheckSymbolExists.cxx.o -c /home/ppy/Repos/graphvite/build/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx Linking CXX executable cmTC_632ad /home/ppy/anaconda3/bin/cmake -E cmake_link_script CMakeFiles/cmTC_632ad.dir/link.txt --verbose=1 /usr/bin/c++ CMakeFiles/cmTC_632ad.dir/CheckSymbolExists.cxx.o -o cmTC_632ad CMakeFiles/cmTC_632ad.dir/CheckSymbolExists.cxx.o: In function main': CheckSymbolExists.cxx:(.text+0x1c): undefined reference topthread_create' collect2: error: ld returned 1 exit status make[1]: [CMakeFiles/cmTC_632ad.dir/build.make:87: cmTC_632ad] Error 1 make[1]: Leaving directory '/home/ppy/Repos/graphvite/build/CMakeFiles/CMakeTmp' make: [Makefile:121: cmTC_632ad/fast] Error 2

File /home/ppy/Repos/graphvite/build/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx: / /

include

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/ppy/Repos/graphvite/build/CMakeFiles/CMakeTmp

Run Build Command(s):/home/ppy/anaconda3/bin/make cmTC_8de8b/fast /home/ppy/anaconda3/bin/make -f CMakeFiles/cmTC_8de8b.dir/build.make CMakeFiles/cmTC_8de8b.dir/build make[1]: Entering directory '/home/ppy/Repos/graphvite/build/CMakeFiles/CMakeTmp' Building CXX object CMakeFiles/cmTC_8de8b.dir/CheckFunctionExists.cxx.o /usr/bin/c++ -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_8de8b.dir/CheckFunctionExists.cxx.o -c /home/ppy/Repos/graphvite/build/CMakeFiles/CheckLibraryExists/CheckFunctionExists.cxx Linking CXX executable cmTC_8de8b /home/ppy/anaconda3/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8de8b.dir/link.txt --verbose=1 /usr/bin/c++ -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_8de8b.dir/CheckFunctionExists.cxx.o -o cmTC_8de8b -lpthreads /usr/bin/ld: cannot find -lpthreads collect2: error: ld returned 1 exit status make[1]: [CMakeFiles/cmTC_8de8b.dir/build.make:87: cmTC_8de8b] Error 1 make[1]: Leaving directory '/home/ppy/Repos/graphvite/build/CMakeFiles/CMakeTmp' make: [Makefile:121: cmTC_8de8b/fast] Error 2

Performing C++ SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output: Change Dir: /home/ppy/Repos/graphvite/build/CMakeFiles/CMakeTmp

Run Build Command(s):/home/ppy/anaconda3/bin/make cmTC_feaff/fast && /home/ppy/anaconda3/bin/make -f CMakeFiles/cmTC_feaff.dir/build.make CMakeFiles/cmTC_feaff.dir/build make[1]: Entering directory '/home/ppy/Repos/graphvite/build/CMakeFiles/CMakeTmp' Building CXX object CMakeFiles/cmTC_feaff.dir/src.cxx.o /usr/bin/c++ -DCMAKE_HAVE_LIBC_PTHREAD -o CMakeFiles/cmTC_feaff.dir/src.cxx.o -c /home/ppy/Repos/graphvite/build/CMakeFiles/CMakeTmp/src.cxx Linking CXX executable cmTC_feaff /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_feaff.dir/link.txt --verbose=1 /usr/bin/c++ -DCMAKE_HAVE_LIBC_PTHREAD CMakeFiles/cmTC_feaff.dir/src.cxx.o -o cmTC_feaff CMakeFiles/cmTC_feaff.dir/src.cxx.o: In function main': src.cxx:(.text+0x3e): undefined reference topthread_create' src.cxx:(.text+0x4a): undefined reference to pthread_detach' src.cxx:(.text+0x5b): undefined reference topthread_join' src.cxx:(.text+0x6f): undefined reference to `pthread_atfork' collect2: error: ld returned 1 exit status make[1]: [CMakeFiles/cmTC_feaff.dir/build.make:87: cmTC_feaff] Error 1 make[1]: Leaving directory '/home/ppy/Repos/graphvite/build/CMakeFiles/CMakeTmp' make: [Makefile:121: cmTC_feaff/fast] Error 2

Source file was:

include

void test_func(void data) { return data; }

int main(void) { pthread_t thread; pthread_create(&thread, NULL, test_func, NULL); pthread_detach(thread); pthread_join(thread, NULL); pthread_atfork(NULL, NULL, NULL); pthread_exit(NULL);

return 0; }

KiddoZhu commented 4 years ago

pthread library is missing. It looks like your C++ compilation tools are not setup properly.

Have you installed the dependencies in conda/requirements.txt? Or you can try conda install gxx_linux-64.