Undefined reference to pthread_create
- Dominant language
- C++
- Stars
- 30.5k
- Forks
- 5.9k
- PR merge metrics
- No merged PRs in 30d
Description
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
int main(int argc, char** argv)
{
(void)argv;
#ifndef pthread_create
return ((int*)(&pthread_create))[argc];
#else
(void)argc;
return 0;
#endif
}
```
Contributor guide
Assessment
This issue has not been assessed yet.