第一个报错是cmake版本太低,要进行升级,但是查询到的是不要卸载cmake,不然会将使用cmake编译过的内容都清除掉,所以直接安装了一个高版本的,使用软连接进行替换,参考如下:
ubuntu20.04安装PX4报错:
查询的说是protobuf版本问题,Gazebo SITL : fatal error: google/protobuf/port_def.inc: No such file or directory · Issue #16242 · PX4/PX4-Autopilot · GitHub
使用命令:
apt list --installed
参考:Ubuntu下如何查看已安装软件版本_ubuntu 查看软件版本-CSDN博客
应该是3.6.1,但是我的版本就是3.6.1;排除
查看PX4版本,是1.14还是1.13,没办法,直接rm,然后重新clone了。
重新clone后,运行命令
make px4_sitl gazebo-classic
还是报错,具体错误忘记记录了。
然后清理make出来的内容:
make clean
make distclean
GIT Examples | PX4 User Guide (main)
想到是不是PX4版本的问题,前面在ubuntu22.04上使用的master版本的编译没有问题,20.04版本可能不能使用最新的??
切换版本:git checkout v1.14.0
同步子模块:make submodulesclean
然后继续编译;
报错如下,其实前面也这样报错了,但是没有想到是qt库的原因,找到文件夹/usr/lib/x86_64-linux-gnu/发现有libEGL.so.1,但是没有libEGL.so。
-- Found GStreamer: GSTREAMER_INCLUDE_DIRS;GSTREAMER_LIBRARIES;GSTREAMER_VERSION;GSTREAMER_BASE_INCLUDE_DIRS;GSTREAMER_BASE_LIBRARIES (Required is at least version "1.0")
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt5Gui/Qt5GuiConfig.cmake:27 (message):
The imported target "Qt5::Gui" references the file
"/usr/lib/x86_64-linux-gnu/libEGL.so"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/x86_64-linux-gnu/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake"
but not all the files it references.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:45 (_qt5_Gui_check_file_exists)
/usr/lib/x86_64-linux-gnu/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:67 (_qt5gui_find_extra_libs)
/usr/lib/x86_64-linux-gnu/cmake/Qt5Gui/Qt5GuiConfig.cmake:186 (include)
/usr/lib/x86_64-linux-gnu/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake:101 (find_package)
/usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake:28 (find_package)
CMakeLists.txt:88 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/linuxin/PX4_projects/PX4-Autopilot/build/px4_sitl_default/build_gazebo-classic/CMakeFiles/CMakeOutput.log".
See also "/home/linuxin/PX4_projects/PX4-Autopilot/build/px4_sitl_default/build_gazebo-classic/CMakeFiles/CMakeError.log".
[134/903] Building CXX object msg/CMakeFiles/uorb_msgs.dir/topics_sources/normalized_unsigned_setpoint.cpp.o
FAILED: external/Stamp/sitl_gazebo-classic/sitl_gazebo-classic-configure /home/linuxin/PX4_projects/PX4-Autopilot/build/px4_sitl_default/external/Stamp/sitl_gazebo-classic/sitl_gazebo-classic-configure
cd /home/linuxin/PX4_projects/PX4-Autopilot/build/px4_sitl_default/build_gazebo-classic && /opt/cmake-3.22.0-rc1/bin/cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DSEND_ODOMETRY_DATA=ON -DGENERATE_ROS_MODELS=ON -GNinja /home/linuxin/PX4_projects/PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic && /opt/cmake-3.22.0-rc1/bin/cmake -E touch /home/linuxin/PX4_projects/PX4-Autopilot/build/px4_sitl_default/external/Stamp/sitl_gazebo-classic/sitl_gazebo-classic-configure
[142/903] Generating uORB topic ucdr headers
ninja: build stopped: subcommand failed.
make: *** [Makefile:232:px4_sitl] 错误 1
需要修改库文件的软连接;
命令:sudo ln /usr/lib/x86_64-linux-gnu/libEGL.so.1 /usr/lib/x86_64-linux-gnu/libEGL.so
参考:PX4 avoidance 功能包编译问题_/usr/lib/x86_64-linux-gnu/libegl.so" but this file-CSDN博客
libEGL.so的报错消失了,又出现libGL.so的报错,继续修改;
命令:sudo ln /usr/lib/x86_64-linux-gnu/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so
终于没有qt库的报错了,又出现新的报错,看着是clone的问题,应该是网络的原因,多试几次:
FAILED: src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-stamp/libmicroxrceddsclient_project-build src/modules/uxrce_dds_client/lib/libmicroxrcedds_client.a src/modules/uxrce_dds_client/lib/libmicrocdr.a /home/linuxin/PX4_projects/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-stamp/libmicroxrceddsclient_project-build /home/linuxin/PX4_projects/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/lib/libmicroxrcedds_client.a /home/linuxin/PX4_projects/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/lib/libmicrocdr.a
cd /home/linuxin/PX4_projects/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-build && /opt/cmake-3.22.0-rc1/bin/cmake -P /home/linuxin/PX4_projects/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-stamp/libmicroxrceddsclient_project-build-RelWithDebInfo.cmake && /opt/cmake-3.22.0-rc1/bin/cmake -E touch /home/linuxin/PX4_projects/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-stamp/libmicroxrceddsclient_project-build
CMake Error at /home/linuxin/PX4_projects/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-stamp/libmicroxrceddsclient_project-build-RelWithDebInfo.cmake:37 (message):
Command failed: 1
'/opt/cmake-3.22.0-rc1/bin/cmake' '--build' '.'
See also
/home/linuxin/PX4_projects/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-stamp/libmicroxrceddsclient_project-build-*.log
-- stdout output is:
[1/16] Creating directories for 'microcdr'
[2/16] Performing download step (git clone) for 'microcdr'
FAILED: microcdr/src/microcdr-stamp/microcdr-download /home/linuxin/PX4_projects/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-build/microcdr/src/microcdr-stamp/microcdr-download
cd /home/linuxin/PX4_projects/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-build/microcdr/src && /opt/cmake-3.22.0-rc1/bin/cmake -P /home/linuxin/PX4_projects/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-build/microcdr/tmp/microcdr-gitclone.cmake && /opt/cmake-3.22.0-rc1/bin/cmake -E touch /home/linuxin/PX4_projects/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-build/microcdr/src/microcdr-stamp/microcdr-download
正克隆到 'microcdr'...
fatal: 无法访问 'https://github.com/eProsima/Micro-CDR.git/':GnuTLS recv error (-110): The TLS connection was non-properly terminated.
正克隆到 'microcdr'...
fatal: 无法访问 'https://github.com/eProsima/Micro-CDR.git/':Failed to connect to github.com port 443: 连接超时
正克隆到 'microcdr'...
fatal: 无法访问 'https://github.com/eProsima/Micro-CDR.git/':Failed to connect to github.com port 443: 连接超时
-- Had to git clone more than once:
3 times.
CMake Error at /home/linuxin/PX4_projects/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-build/microcdr/tmp/microcdr-gitclone.cmake:31 (message):
Failed to clone repository: 'https://github.com/eProsima/Micro-CDR.git'
ninja: build stopped: subcommand failed.
-- stderr output is:
CMake Error at /home/linuxin/PX4_projects/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-stamp/libmicroxrceddsclient_project-build-RelWithDebInfo.cmake:47 (message):
Stopping after outputting logs.
ninja: build stopped: subcommand failed.
make: *** [Makefile:232:px4_sitl] 错误 1
最后终于编译成功了
但是gazebo只有6帧,好低阿!