CMakeError.log 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
  2. Change Dir: /home/cicv/work/26_pji/simulation/jiaofu_20240521_lingxin/catkin_ws/build/CMakeFiles/CMakeTmp
  3. Run Build Command(s):/usr/bin/make -f Makefile cmTC_826a3/fast && /usr/bin/make -f CMakeFiles/cmTC_826a3.dir/build.make CMakeFiles/cmTC_826a3.dir/build
  4. make[1]: 进入目录“/home/cicv/work/26_pji/simulation/jiaofu_20240521_lingxin/catkin_ws/build/CMakeFiles/CMakeTmp”
  5. Building C object CMakeFiles/cmTC_826a3.dir/src.c.o
  6. /usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD -o CMakeFiles/cmTC_826a3.dir/src.c.o -c /home/cicv/work/26_pji/simulation/jiaofu_20240521_lingxin/catkin_ws/build/CMakeFiles/CMakeTmp/src.c
  7. Linking C executable cmTC_826a3
  8. /usr/local/cmake/bin/cmake -E cmake_link_script CMakeFiles/cmTC_826a3.dir/link.txt --verbose=1
  9. /usr/bin/cc -rdynamic CMakeFiles/cmTC_826a3.dir/src.c.o -o cmTC_826a3
  10. /usr/bin/ld: CMakeFiles/cmTC_826a3.dir/src.c.o: in function `main':
  11. src.c:(.text+0x46): undefined reference to `pthread_create'
  12. /usr/bin/ld: src.c:(.text+0x52): undefined reference to `pthread_detach'
  13. /usr/bin/ld: src.c:(.text+0x5e): undefined reference to `pthread_cancel'
  14. /usr/bin/ld: src.c:(.text+0x6f): undefined reference to `pthread_join'
  15. collect2: error: ld returned 1 exit status
  16. make[1]: *** [CMakeFiles/cmTC_826a3.dir/build.make:99:cmTC_826a3] 错误 1
  17. make[1]: 离开目录“/home/cicv/work/26_pji/simulation/jiaofu_20240521_lingxin/catkin_ws/build/CMakeFiles/CMakeTmp”
  18. make: *** [Makefile:127:cmTC_826a3/fast] 错误 2
  19. Source file was:
  20. #include <pthread.h>
  21. static void* test_func(void* data)
  22. {
  23. return data;
  24. }
  25. int main(void)
  26. {
  27. pthread_t thread;
  28. pthread_create(&thread, NULL, test_func, NULL);
  29. pthread_detach(thread);
  30. pthread_cancel(thread);
  31. pthread_join(thread, NULL);
  32. pthread_atfork(NULL, NULL, NULL);
  33. pthread_exit(NULL);
  34. return 0;
  35. }
  36. Determining if the function pthread_create exists in the pthreads failed with the following output:
  37. Change Dir: /home/cicv/work/26_pji/simulation/jiaofu_20240521_lingxin/catkin_ws/build/CMakeFiles/CMakeTmp
  38. Run Build Command(s):/usr/bin/make -f Makefile cmTC_84217/fast && /usr/bin/make -f CMakeFiles/cmTC_84217.dir/build.make CMakeFiles/cmTC_84217.dir/build
  39. make[1]: 进入目录“/home/cicv/work/26_pji/simulation/jiaofu_20240521_lingxin/catkin_ws/build/CMakeFiles/CMakeTmp”
  40. Building C object CMakeFiles/cmTC_84217.dir/CheckFunctionExists.c.o
  41. /usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_84217.dir/CheckFunctionExists.c.o -c /usr/local/cmake/share/cmake-3.20/Modules/CheckFunctionExists.c
  42. Linking C executable cmTC_84217
  43. /usr/local/cmake/bin/cmake -E cmake_link_script CMakeFiles/cmTC_84217.dir/link.txt --verbose=1
  44. /usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -rdynamic CMakeFiles/cmTC_84217.dir/CheckFunctionExists.c.o -o cmTC_84217 -lpthreads
  45. /usr/bin/ld: 找不到 -lpthreads
  46. collect2: error: ld returned 1 exit status
  47. make[1]: *** [CMakeFiles/cmTC_84217.dir/build.make:99:cmTC_84217] 错误 1
  48. make[1]: 离开目录“/home/cicv/work/26_pji/simulation/jiaofu_20240521_lingxin/catkin_ws/build/CMakeFiles/CMakeTmp”
  49. make: *** [Makefile:127:cmTC_84217/fast] 错误 2