gensim-project / gensim

The GenSim project
MIT License
14 stars 13 forks source link

Cmake throwing pthread issues in Ubuntu 20.04.1 #4

Open tr0nand opened 4 years ago

tr0nand commented 4 years ago

The CMakeError log has the following output -

`Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output: Change Dir: /home/tarun/Desktop/gensim/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_1cc70/fast && /usr/bin/make -f CMakeFiles/cmTC_1cc70.dir/build.make CMakeFiles/cmTC_1cc70.dir/build make[1]: Entering directory '/home/tarun/Desktop/gensim/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_1cc70.dir/src.c.o /usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD -o CMakeFiles/cmTC_1cc70.dir/src.c.o -c /home/tarun/Desktop/gensim/CMakeFiles/CMakeTmp/src.c Linking C executable cmTC_1cc70 /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_1cc70.dir/link.txt --verbose=1 /usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD -rdynamic CMakeFiles/cmTC_1cc70.dir/src.c.o -o cmTC_1cc70 /usr/bin/ld: CMakeFiles/cmTC_1cc70.dir/src.c.o: in function main': src.c:(.text+0x46): undefined reference topthread_create' /usr/bin/ld: src.c:(.text+0x52): undefined reference to pthread_detach' /usr/bin/ld: src.c:(.text+0x63): undefined reference topthread_join' collect2: error: ld returned 1 exit status make[1]: [CMakeFiles/cmTC_1cc70.dir/build.make:87: cmTC_1cc70] Error 1 make[1]: Leaving directory '/home/tarun/Desktop/gensim/CMakeFiles/CMakeTmp' make: [Makefile:121: cmTC_1cc70/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; } `

tspink commented 4 years ago

Hi Tarun,

Have you got the pthread development libraries installed? Are you able to compile your own small pthread test program outside of the build environment?

Best wishes, Tom

tr0nand commented 4 years ago

Hello Tom

Yes, I have the pthread development libraries installed. I ran a sample pthread test program and it seems to work fine. I believe this has something to do with the cmake file. I found other people also had similar issues with cmake and pthread - Link. However, the fix they suggested doesn't seem to correct it for me.

Thanks for your help Tarun