当前位置:网站首页>Cmake has no obvious error after compilation, but prompts that pthread cannot be found
Cmake has no obvious error after compilation, but prompts that pthread cannot be found
2022-06-13 01:39:00 【lainegates】
cmake Construction Engineering , After completion , There are no obvious mistakes , But it's a hint "Configuration failed".
After careful examination , Cause of error and "Error.log" It doesn't matter at all !
terms of settlement: Go over the newly revisedCMakeLists.txt, There must beCall error/Write lessThe place of
Error file "Error.log" The error of is similar to the following :
Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: ${projectDir}/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_c7717/fast && /usr/bin/make -f CMakeFiles/cmTC_c7717.dir/build.make CMakeFiles/cmTC_c7717.dir/build
make[1]: Entering directory '${projectDir}/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_c7717.dir/src.c.o
/usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD -O2 -DNDEBUG -g -fno-omit-frame-pointer -fPIE -o CMakeFiles/cmTC_c7717.dir/src.c.o -c ${projectDir}/build/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTC_c7717
/usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_c7717.dir/link.txt --verbose=1
/usr/bin/cc -O2 -DNDEBUG -g -fno-omit-frame-pointer CMakeFiles/cmTC_c7717.dir/src.c.o -o cmTC_c7717
CMakeFiles/cmTC_c7717.dir/src.c.o: In function `main': ${
projectDir}/build/CMakeFiles/CMakeTmp/src.c:11: undefined reference to `pthread_create' ${projectDir}/build/CMakeFiles/CMakeTmp/src.c:12: undefined reference to `pthread_detach' ${
projectDir}/build/CMakeFiles/CMakeTmp/src.c:13: undefined reference to `pthread_cancel'
${projectDir}/build/CMakeFiles/CMakeTmp/src.c:14: undefined reference to `pthread_join' ${
projectDir}/build/CMakeFiles/CMakeTmp/src.c:15: undefined reference to `pthread_atfork' collect2: error: ld returned 1 exit status CMakeFiles/cmTC_c7717.dir/build.make:105: recipe for target 'cmTC_c7717' failed make[1]: *** [cmTC_c7717] Error 1 make[1]: Leaving directory '${projectDir}/build/CMakeFiles/CMakeTmp' Makefile:140: recipe for target 'cmTC_c7717/fast' failed make: *** [cmTC_c7717/fast] Error 2 Source file was: #include <pthread.h> static void* test_func(void* data) { return data; } int main(void) { pthread_t thread; pthread_create(&thread, NULL, test_func, NULL); pthread_detach(thread); pthread_cancel(thread); pthread_join(thread, NULL); pthread_atfork(NULL, NULL, NULL); pthread_exit(NULL); return 0; } Determining if the function pthread_create exists in the pthreads failed with the following output: Change Dir: ${projectDir}/build/CMakeFiles/CMakeTmp Run Build Command(s):/usr/bin/make cmTC_a697d/fast && /usr/bin/make -f CMakeFiles/cmTC_a697d.dir/build.make CMakeFiles/cmTC_a697d.dir/build make[1]: Entering directory '${projectDir}/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_a697d.dir/CheckFunctionExists.c.o /usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -O2 -DNDEBUG -g -fno-omit-frame-pointer -fPIE -o CMakeFiles/cmTC_a697d.dir/CheckFunctionExists.c.o -c /usr/local/share/cmake-3.19/Modules/CheckFunctionExists.c Linking C executable cmTC_a697d /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_a697d.dir/link.txt --verbose=1 /usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -O2 -DNDEBUG -g -fno-omit-frame-pointer CMakeFiles/cmTC_a697d.dir/CheckFunctionExists.c.o -o cmTC_a697d -lpthreads /usr/bin/ld: cannot find -lpthreads collect2: error: ld returned 1 exit status CMakeFiles/cmTC_a697d.dir/build.make:105: recipe for target 'cmTC_a697d' failed make[1]: *** [cmTC_a697d] Error 1 make[1]: Leaving directory '${projectDir}/build/CMakeFiles/CMakeTmp' Makefile:140: recipe for target 'cmTC_a697d/fast' failed make: *** [cmTC_a697d/fast] Error 2 Determining if the strtod_l exist failed with the following output: Change Dir: ${projectDir}/build/CMakeFiles/CMakeTmp Run Build Command(s):/usr/bin/make cmTC_da49d/fast && /usr/bin/make -f CMakeFiles/cmTC_da49d.dir/build.make CMakeFiles/cmTC_da49d.dir/build make[1]: Entering directory '${projectDir}/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_da49d.dir/CheckSymbolExists.c.o /usr/bin/cc -O2 -DNDEBUG -g -fno-omit-frame-pointer -fPIE -o CMakeFiles/cmTC_da49d.dir/CheckSymbolExists.c.o -c ${projectDir}/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c ${projectDir}/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c: In function 'main': ${projectDir}/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: error: 'strtod_l' undeclared (first use in this function); did you mean 'strtoull'? return ((int*)(&strtod_l))[argc]; ^~~~~~~~ strtoull ${projectDir}/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: note: each undeclared identifier is reported only once for each function it appears in CMakeFiles/cmTC_da49d.dir/build.make:84: recipe for target 'CMakeFiles/cmTC_da49d.dir/CheckSymbolExists.c.o' failed make[1]: *** [CMakeFiles/cmTC_da49d.dir/CheckSymbolExists.c.o] Error 1 make[1]: Leaving directory '${projectDir}/build/CMakeFiles/CMakeTmp' Makefile:140: recipe for target 'cmTC_da49d/fast' failed
make: *** [cmTC_da49d/fast] Error 2
File ${projectDir}/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <stdlib.h>
int main(int argc, char** argv)
{
(void)argv;
#ifndef strtod_l
return ((int*)(&strtod_l))[argc];
#else
(void)argc;
return 0;
#endif
}
边栏推荐
- Docker install MySQL
- Leetcode question brushing 03 stack
- numpy多维数组转置transpose
- Uuid/guid introduction, generation rules and generation codes
- Tweens of phaser3
- np. Understanding of axis in concatenate
- 白噪声的详细理解
- Stack and queue practice (C language): Demon King's language
- About tkinter Canvas does not display pictures
- Anims of phaser3
猜你喜欢
随机推荐
redis
Anims of phaser3
Camera model_
[MathType] use MathType to output latex style formula
Go JWT learning summary
[andoid][step pit]cts 11_ Testbootclasspathandsystemserverclasspath at the beginning of R3_ Analysis of nonduplicateclasses fail
他山之石:a16z 的 Web3 投资版图
FLIP动画实现思路
H5 open the app. If the app is not downloaded, jump to the download page. If the app has been downloaded, wake up the app
Quickly set the computer to turn off automatically
leetcode743. Network latency (medium, Dijkstra)
谷歌的受众群体是如何发挥作用的?
[Stanford Jiwang cs144 project] lab1: streamreassembler
【斯坦福计网CS144项目】Lab1: StreamReassembler
This of phaser3 add. sprite
[wsl2]wsl2 migrate virtual disk file ext4 vhdx
Lecture on Compilation Principles
Leetcode 05 tree
如何利用您的自有数据来实现营销目标?
三、上传织物图片至SQL Server并提供name进行展示织物照片








