首页 > 解决方案 > MacOS QT5 / QT6 都安装了构建问题

问题描述

我正在尝试构建一个依赖于 QT5 的项目(特别是使用 Gazebo 模拟器的 PX4 SITL)。我的机器上同时安装了 QT5 和 QT6。构建失败是因为它在 /usr/local/include 中获取 QT 头文件。这些头文件是 QT6 头文件。我的问题是它为什么要这样做?编译器命令没有到 /usr/local/include/<QT...> 的包含路径,而且我没有任何环境变量。我相信我可以卸载或取消链接 QT6 来解决这个问题,我想我会这样做,但我很想知道它为什么不起作用。

这是构建的输出(我已将 arg! 添加到 /usr/local/include/QtWidgets 中的 qstyleoption.h)

FAILED: CMakeFiles/gazebo_user_camera_plugin.dir/src/gazebo_user_camera_plugin.cpp.o 
/usr/local/bin/ccache /Library/Developer/CommandLineTools/usr/bin/c++ -DBOOST_ALL_NO_LIB -DBOOST_DATE_TIME_DYN_LINK -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_IOSTREAMS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_REGEX_DYN_LINK -DBOOST_SYSTEM_DYN_LINK -DBOOST_TEST_DYN_LINK -DBOOST_THREAD_DYN_LINK -DLIBBULLET_VERSION=3.17 -DLIBBULLET_VERSION_GT_282 -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -Dgazebo_user_camera_plugin_EXPORTS -I/Users/jerrymailloux/dev/PX4/PX4-Autopilot/Tools/sitl_gazebo/include -I/Users/jerrymailloux/dev/PX4/PX4-Autopilot/build/px4_sitl_default/build_gazebo -I/usr/local/include/eigen3/eigen3 -I/usr/local/include/gazebo-11/gazebo/msgs -I/Users/jerrymailloux/dev/PX4/PX4-Autopilot/mavlink/include -I/Users/jerrymailloux/dev/PX4/PX4-Autopilot/Tools/sitl_gazebo/external/OpticalFlow/include -I/usr/local/Cellar/libffi/3.4.2/include -I/usr/local/Cellar/gstreamer/1.18.4/include/gstreamer-1.0 -I/usr/local/Cellar/glib/2.70.0_1/include -I/usr/local/Cellar/glib/2.70.0_1/include/glib-2.0 -I/usr/local/Cellar/glib/2.70.0_1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.45/include -I/usr/local/Cellar/gst-plugins-base/1.18.4/include/gstreamer-1.0 -isystem /usr/local/include -isystem /usr/local/include/gazebo-11 -isystem /usr/local/Cellar/bullet/3.17/include/bullet -isystem /usr/local/Cellar/bullet/3.17/include -isystem /usr/local/include/simbody -isystem /usr/local/Cellar/sdformat9/9.6.1_1/include/sdformat-9.6 -isystem /usr/local/include/ignition/math6 -isystem /usr/local/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/include/OGRE -isystem /usr/local/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/include -isystem /usr/local/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/include/OGRE/Terrain -isystem /usr/local/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/include/OGRE/Paging -isystem /usr/local/include/ignition/transport8 -isystem /usr/local/include/ignition/msgs5 -isystem /usr/local/include/ignition/common3 -isystem /usr/local/include/ignition/fuel_tools4 -iframework /usr/local/opt/qt@5/lib -isystem /usr/local/opt/qt@5/lib/QtCore.framework/Headers -isystem /usr/local/opt/qt@5/./mkspecs/macx-clang -isystem /usr/local/include/eigen3 -isystem /usr/local/Cellar/opencv/4.5.3_2/include/opencv4 -isystem /usr/local/Cellar/fcl/0.7.0/include -isystem /usr/local/include/sdformat-9.6/sdf/.. -isystem /usr/local/include/ignition/cmake2 -isystem /usr/local/opt/qt@5/lib/QtWidgets.framework/Headers -isystem /usr/local/opt/qt@5/lib/QtGui.framework/Headers -isystem /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/OpenGL.framework/Headers -O2 -g -DNDEBUG -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -fPIC -Wno-deprecated-declarations -Wno-address-of-packed-member -fPIC -std=gnu++17 -MD -MT CMakeFiles/gazebo_user_camera_plugin.dir/src/gazebo_user_camera_plugin.cpp.o -MF CMakeFiles/gazebo_user_camera_plugin.dir/src/gazebo_user_camera_plugin.cpp.o.d -o CMakeFiles/gazebo_user_camera_plugin.dir/src/gazebo_user_camera_plugin.cpp.o -c /Users/jerrymailloux/dev/PX4/PX4-Autopilot/Tools/sitl_gazebo/src/gazebo_user_camera_plugin.cpp
In file included from /Users/jerrymailloux/dev/PX4/PX4-Autopilot/Tools/sitl_gazebo/src/gazebo_user_camera_plugin.cpp:46:
In file included from /Users/jerrymailloux/dev/PX4/PX4-Autopilot/Tools/sitl_gazebo/include/gazebo_user_camera_plugin.h:46:
In file included from /usr/local/include/gazebo-11/gazebo/gui/GuiPlugin.hh:20:
In file included from /usr/local/include/gazebo-11/gazebo/gui/qt.h:44:
In file included from /usr/local/include/QtWidgets/QComboBox:1:
In file included from /usr/local/include/QtWidgets/qcombobox.h:45:
In file included from /usr/local/include/QtWidgets/qabstractitemdelegate.h:45:
/usr/local/include/QtWidgets/qstyleoption.h:71:1: error: unknown type name 'arg'
arg!

标签: macosqtbuild

解决方案


推荐阅读