An error occurred while installing PX4 and I don't know how to fix it

75 views Asked by At

When I compile PX4, the following error occurs

-- Configuring incomplete, errors occurred!
See also "/home/spric/PX4_Firmware/build/px4_sitl_default/build_gazebo/CMakeFiles/CMakeOutput.log".
See also "/home/spric/PX4_Firmware/build/px4_sitl_default/build_gazebo/CMakeFiles/CMakeError.log".
platforms/posix/CMakeFiles/sitl_gazebo.dir/build.make:105: recipe for target 'external/Stamp/sitl_gazebo/sitl_gazebo-configure' failed
make[4]: *** [external/Stamp/sitl_gazebo/sitl_gazebo-configure] Error 1
CMakeFiles/Makefile2:58891: recipe for target 'platforms/posix/CMakeFiles/sitl_gazebo.dir/all' failed
make[3]: *** [platforms/posix/CMakeFiles/sitl_gazebo.dir/all] Error 2
CMakeFiles/Makefile2:35444: recipe for target 'platforms/posix/CMakeFiles/gazebo.dir/rule' failed
make[2]: *** [platforms/posix/CMakeFiles/gazebo.dir/rule] Error 2
Makefile:10950: recipe for target 'gazebo' failed
make[1]: *** [gazebo] Error 2
Makefile:230: recipe for target 'px4_sitl_default' failed
make: *** [px4_sitl_default] Error 2

Here are the ERROR output files

1.CMakeError.log:

Determining if the pthread_create exist failed with the following output:
Change Dir: /home/spric/PX4_Firmware/build/px4_sitl_default/build_gazebo/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_abcea/fast"
make[5]: 进入目录“/home/spric/PX4_Firmware/build/px4_sitl_default/build_gazebo/CMakeFiles/CMakeTmp”
/usr/bin/make -f CMakeFiles/cmTC_abcea.dir/build.make CMakeFiles/cmTC_abcea.dir/build
make[6]: 进入目录“/home/spric/PX4_Firmware/build/px4_sitl_default/build_gazebo/CMakeFiles/CMakeTmp”
Building C object CMakeFiles/cmTC_abcea.dir/CheckSymbolExists.c.o
/usr/bin/cc    -o CMakeFiles/cmTC_abcea.dir/CheckSymbolExists.c.o   -c /home/spric/PX4_Firmware/build/px4_sitl_default/build_gazebo/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_abcea
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_abcea.dir/link.txt --verbose=1
/usr/bin/cc      CMakeFiles/cmTC_abcea.dir/CheckSymbolExists.c.o  -o cmTC_abcea 
CMakeFiles/cmTC_abcea.dir/CheckSymbolExists.c.o:在函数‘main’中:
CheckSymbolExists.c:(.text+0x1b):对‘pthread_create’未定义的引用
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_abcea.dir/build.make:97: recipe for target 'cmTC_abcea' failed
make[6]: *** [cmTC_abcea] Error 1
make[6]: 离开目录“/home/spric/PX4_Firmware/build/px4_sitl_default/build_gazebo/CMakeFiles/CMakeTmp”
Makefile:126: recipe for target 'cmTC_abcea/fast' failed
make[5]: *** [cmTC_abcea/fast] Error 2
make[5]: 离开目录“/home/spric/PX4_Firmware/build/px4_sitl_default/build_gazebo/CMakeFiles/CMakeTmp”

File /home/spric/PX4_Firmware/build/px4_sitl_default/build_gazebo/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
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/spric/PX4_Firmware/build/px4_sitl_default/build_gazebo/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_5c22b/fast"
make[5]: 进入目录“/home/spric/PX4_Firmware/build/px4_sitl_default/build_gazebo/CMakeFiles/CMakeTmp”
/usr/bin/make -f CMakeFiles/cmTC_5c22b.dir/build.make CMakeFiles/cmTC_5c22b.dir/build
make[6]: 进入目录“/home/spric/PX4_Firmware/build/px4_sitl_default/build_gazebo/CMakeFiles/CMakeTmp”
Building C object CMakeFiles/cmTC_5c22b.dir/CheckFunctionExists.c.o
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_5c22b.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.10/Modules/CheckFunctionExists.c
Linking C executable cmTC_5c22b
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_5c22b.dir/link.txt --verbose=1
/usr/bin/cc  -DCHECK_FUNCTION_EXISTS=pthread_create    CMakeFiles/cmTC_5c22b.dir/CheckFunctionExists.c.o  -o cmTC_5c22b -lpthreads 
/usr/bin/ld: 找不到 -lpthreads
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_5c22b.dir/build.make:97: recipe for target 'cmTC_5c22b' failed
make[6]: *** [cmTC_5c22b] Error 1
make[6]: 离开目录“/home/spric/PX4_Firmware/build/px4_sitl_default/build_gazebo/CMakeFiles/CMakeTmp”
Makefile:126: recipe for target 'cmTC_5c22b/fast' failed
make[5]: *** [cmTC_5c22b/fast] Error 2
make[5]: 离开目录“/home/spric/PX4_Firmware/build/px4_sitl_default/build_gazebo/CMakeFiles/CMakeTmp”

I tried trying to retry and search, but I didn't find it. I hope this error goes away and compiles successfully.Some methods on the Internet are different from mine。I would very much appreciate it if you could help me with this。

0

There are 0 answers