folly
folly copied to clipboard
Undefined reference to pthread_create
I got the following error when running ./build.sh
I'm on Ubuntu 20 with WSL. GCC 9.3.0
Another person posted the same issue earlier, but closed it: https://github.com/facebook/folly/issues/1377
How do I fix it?
Determining if the pthread_create exist failed with the following output:
Change Dir: /tmp/fbcode_builder_getdeps-ZhomeZtchingZDownloadsZfollyZbuildZfbcode_builder/build/folly/CMakeFiles/CMakeTmp
Run Build Command(s):/tmp/fbcode_builder_getdeps-ZhomeZtchingZDownloadsZfollyZbuildZfbcode_builder/installed/ninja-bbPkhaVDuJph3FgUpWo0w7J2R7ybohnLl2-cJn2LsPM/bin/ninja cmTC_0b481
[1/2] Building C object CMakeFiles/cmTC_0b481.dir/CheckSymbolExists.c.o
[2/2] Linking C executable cmTC_0b481
FAILED: cmTC_0b481
: && /usr/bin/cc -rdynamic CMakeFiles/cmTC_0b481.dir/CheckSymbolExists.c.o -o cmTC_0b481 && :
/usr/bin/ld: CMakeFiles/cmTC_0b481.dir/CheckSymbolExists.c.o: in function `main':
CheckSymbolExists.c:(.text+0x1f): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
File /tmp/fbcode_builder_getdeps-ZhomeZtchingZDownloadsZfollyZbuildZfbcode_builder/build/folly/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
}
My business account Global network
Hi, I'm not sure but it could be that a link to the pthread library (-lpthread) is missing at linking time. By adding "-v" to the compiler options it should be possible to check if that is the case.
This affects me also. So what is the decision on how to change libfolly regarding this issue?
Focus on cmake error before this, which told me that Openssl is dependency and not found, after install openssl this pthread undefined problem resolved.
Before error is can not find openssl so solution is sudo apt install libssl-dev