QGroundControl@Jetson Orin Nano - 从代码编译安装

133 篇文章 87 订阅

1. 源由

先说结论:直接从QGroundControl代码在Jetson Orin Nano板子上编译不成功!

按照以下文档中的步骤和方法进行编译,最后卡在:

  1. Getting Started with Source and Builds
  2. Building Qt 6 from Git
/home/daniel/QGC/qgroundcontrol/libs/qmlglsink/qt6/gstqt6glutility.cc: In function ‘GstGLDisplay* gst_qml6_get_gl_display(gboolean)’:
/home/daniel/QGC/qgroundcontrol/libs/qmlglsink/qt6/gstqt6glutility.cc:94:62: error: ‘QX11Application’ is not a member of ‘QNativeInterface’; did you mean ‘QWaylandApplication’?
   94 |     auto x11_native = app->nativeInterface<QNativeInterface::QX11Application>();
      |                                                              ^~~~~~~~~~~~~~~
      |                                                              QWaylandApplication
/home/daniel/QGC/qgroundcontrol/libs/qmlglsink/qt6/gstqt6glutility.cc:94:79: error: no matching function for call to ‘QGuiApplication::nativeInterface<<expression error> >()94 |     auto x11_native = app->nativeInterface<QNativeInterface::QX11Application>();
      |                                                                               ^
In file included from /home/daniel/QGC/qt6/qt6-install/include/QtCore/qcoreapplication.h:16,
                 from /home/daniel/QGC/qt6/qt6-install/include/QtGui/qguiapplication.h:8,
                 from /home/daniel/QGC/qt6/qt6-install/include/QtGui/QGuiApplication:1,
                 from /home/daniel/QGC/qgroundcontrol/libs/qmlglsink/qt6/gstqt6glutility.cc:26:
/home/daniel/QGC/qt6/qt6-install/include/QtGui/qguiapplication.h:142:5: note: candidate: ‘template<class NativeInterface, class TypeInfo, class BaseType, typename std::enable_if<TypeInfo::isCompatibleWith<QGuiApplication>, bool>::type <anonymous> > NativeInterface* QGuiApplication::nativeInterface() const’
  142 |     QT_DECLARE_NATIVE_INTERFACE_ACCESSOR(QGuiApplication)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/daniel/QGC/qt6/qt6-install/include/QtGui/qguiapplication.h:142:5: note:   template argument deduction/substitution failed:
/home/daniel/QGC/qgroundcontrol/libs/qmlglsink/qt6/gstqt6glutility.cc:94:79: error: template argument 1 is invalid
   94 |     auto x11_native = app->nativeInterface<QNativeInterface::QX11Application>();
      |                                                                               ^
At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-unused-private-field’
ninja: build stopped: subcommand failed.

2. 步骤

注:/path/to/install是安装路径,请根据实际需要进行安装目录调整。

2.1 QT 编译

注:推荐使用6.6.3版本,但是笔者也试过5.15.2

  • QGC最新master(5a348d3) + QT6.6.3 ==》失败
  • QGC-Stable4.4 + QT6.6.3 ==》失败
  • QGC-Stable4.4 + QT5.15.2 ==》失败

2.1.1 下载

$ git clone git://code.qt.io/qt/qt5.git qt6

2.1.2 版本

$ cd qt6
$ git checkout 6.6.3

2.1.3 初始化

$ perl init-repository

2.1.4 配置

$ mkdir qt6-build
$ ./configure -prefix /path/to/install

2.1.5 编译

$ cmake --build . --parallel 4

2.1.6 安装

$ cmake --install .

2.2 QGC 编译

2.2.1 下载

$ git clone --recursive -j8 https://github.com/mavlink/qgroundcontrol.git

2.2.2 版本

$ cd qgroundcontrol
$ git checkout Stable_V4.4

2.2.3 初始化

$ git submodule update --recursive

2.2.4 配置

$ cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=/path/to/install

2.2.5 编译

$ cmake --build build --config Debug

注:改步骤由于X11(QNativeInterface::QX11Application)的问题,始终无法通过,换衣X11依赖等方面在Jetson Orin Nano上存在一些问题。

2.2.6 安装

$ ./build/QGroundControl

2.2.7 QT5命令备注

$ git clone git://code.qt.io/qt/qt5.git qt5
$ git checkout 5.15.2
$ perl init-repository
$ mkdir qt5-build
$ ./configure -prefix /path/to/install
$ make
$ make install

3. 可行方案

采用Installing-QGroundControl-on-Ubuntu-ARM64-using-Flatpak) 方案安装可行。

在这里插入图片描述

4. 总结

如果有朋友知道如何解决上述问题,也请告知,谢谢!

相关内容的进一步讨论: How did Flatpak build QGC for Jetson? #1

5. 补充 - 问题清单

5.1 cmake配置命令错误

$ cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=/path/to/install
$ cmake -B build -G Ninja CMAKE_BUILD_TYPE=Debug
CMake Error: The source directory "/home/daniel/QGC/qgroundcontrol/CMAKE_BUILD_TYPE=Debug" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.


$ cmake -B build -G Ninja
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
  CMake 3.22.1 or higher is required.  You are running version 3.16.3


-- Configuring incomplete, errors occurred!

5.2 qtconnectivity5-dev库问题

$ sudo apt-get install qtconnectivity5-dev
CMake Error at /usr/lib/aarch64-linux-gnu/cmake/Qt5/Qt5Config.cmake:28 (find_package):
  Could not find a package configuration file provided by "Qt5Bluetooth" with
  any of the following names:

    Qt5BluetoothConfig.cmake
    qt5bluetooth-config.cmake

  Add the installation prefix of "Qt5Bluetooth" to CMAKE_PREFIX_PATH or set
  "Qt5Bluetooth_DIR" to a directory containing one of the above files.  If
  "Qt5Bluetooth" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  CMakeLists.txt:123 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/daniel/QGC/qgroundcontrol/build/CMakeFiles/CMakeOutput.log".

5.3 libqt5charts5-dev库问题

$ sudo apt-get install libqt5charts5-dev
CMake Error at /usr/lib/aarch64-linux-gnu/cmake/Qt5/Qt5Config.cmake:28 (find_package):
  Could not find a package configuration file provided by "Qt5Charts" with
  any of the following names:

    Qt5ChartsConfig.cmake
    qt5charts-config.cmake

  Add the installation prefix of "Qt5Charts" to CMAKE_PREFIX_PATH or set
  "Qt5Charts_DIR" to a directory containing one of the above files.  If
  "Qt5Charts" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:123 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/daniel/QGC/qgroundcontrol/build/CMakeFiles/CMakeOutput.log".

5.4 qtlocation5-dev库问题

$ sudo apt-get install qtlocation5-dev
CMake Error at /usr/lib/aarch64-linux-gnu/cmake/Qt5/Qt5Config.cmake:28 (find_package):
  Could not find a package configuration file provided by "Qt5Location" with
  any of the following names:

    Qt5LocationConfig.cmake
    qt5location-config.cmake

  Add the installation prefix of "Qt5Location" to CMAKE_PREFIX_PATH or set
  "Qt5Location_DIR" to a directory containing one of the above files.  If
  "Qt5Location" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  CMakeLists.txt:123 (find_package)


-- Configuring incomplete, errors occurred!

5.5 qtpositioning5-dev库问题

$ sudo apt-get install qtpositioning5-dev
CMake Error at /usr/lib/aarch64-linux-gnu/cmake/Qt5Location/Qt5LocationConfig.cmake:101 (find_package):
  Could not find a package configuration file provided by
  "Qt5PositioningQuick" (requested version 5.12.8) with any of the following
  names:

    Qt5PositioningQuickConfig.cmake
    qt5positioningquick-config.cmake

  Add the installation prefix of "Qt5PositioningQuick" to CMAKE_PREFIX_PATH
  or set "Qt5PositioningQuick_DIR" to a directory containing one of the above
  files.  If "Qt5PositioningQuick" provides a separate development package or
  SDK, be sure it has been installed.
Call Stack (most recent call first):
  /usr/lib/aarch64-linux-gnu/cmake/Qt5/Qt5Config.cmake:28 (find_package)
  CMakeLists.txt:123 (find_package)


-- Configuring incomplete, errors occurred!

5.6 qtmultimedia5-dev库问题

$ sudo apt-get install qtmultimedia5-dev
CMake Error at /usr/lib/aarch64-linux-gnu/cmake/Qt5/Qt5Config.cmake:28 (find_package):
  Could not find a package configuration file provided by "Qt5Multimedia"
  with any of the following names:

    Qt5MultimediaConfig.cmake
    qt5multimedia-config.cmake

  Add the installation prefix of "Qt5Multimedia" to CMAKE_PREFIX_PATH or set
  "Qt5Multimedia_DIR" to a directory containing one of the above files.  If
  "Qt5Multimedia" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  CMakeLists.txt:123 (find_package)


-- Configuring incomplete, errors occurred!

5.7 qtquickcontrols2-5-dev库问题

$ sudo apt-get install qtquickcontrols2-5-dev
CMake Error at /usr/lib/aarch64-linux-gnu/cmake/Qt5/Qt5Config.cmake:28 (find_package):
  Could not find a package configuration file provided by "Qt5QuickControls2"
  with any of the following names:

    Qt5QuickControls2Config.cmake
    qt5quickcontrols2-config.cmake

  Add the installation prefix of "Qt5QuickControls2" to CMAKE_PREFIX_PATH or
  set "Qt5QuickControls2_DIR" to a directory containing one of the above
  files.  If "Qt5QuickControls2" provides a separate development package or
  SDK, be sure it has been installed.
Call Stack (most recent call first):
  CMakeLists.txt:123 (find_package)


-- Configuring incomplete, errors occurred!

5.8 libqt5svg5-dev库问题

$ sudo apt-get install libqt5svg5-dev
CMake Error at /usr/lib/aarch64-linux-gnu/cmake/Qt5/Qt5Config.cmake:28 (find_package):
  Could not find a package configuration file provided by "Qt5Svg" with any
  of the following names:

    Qt5SvgConfig.cmake
    qt5svg-config.cmake

  Add the installation prefix of "Qt5Svg" to CMAKE_PREFIX_PATH or set
  "Qt5Svg_DIR" to a directory containing one of the above files.  If "Qt5Svg"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  CMakeLists.txt:123 (find_package)


-- Configuring incomplete, errors occurred!

5.9 libqt5texttospeech5-dev库问题

$ sudo apt-get install libqt5texttospeech5-dev
CMake Error at /usr/lib/aarch64-linux-gnu/cmake/Qt5/Qt5Config.cmake:28 (find_package):
  Could not find a package configuration file provided by "Qt5TextToSpeech"
  with any of the following names:

    Qt5TextToSpeechConfig.cmake
    qt5texttospeech-config.cmake

  Add the installation prefix of "Qt5TextToSpeech" to CMAKE_PREFIX_PATH or
  set "Qt5TextToSpeech_DIR" to a directory containing one of the above files.
  If "Qt5TextToSpeech" provides a separate development package or SDK, be
  sure it has been installed.
Call Stack (most recent call first):
  CMakeLists.txt:123 (find_package)


-- Configuring incomplete, errors occurred!

5.10 libqt5serialport5-dev库问题

$ sudo apt-get install libqt5serialport5-dev
CMake Error at /usr/lib/aarch64-linux-gnu/cmake/Qt5/Qt5Config.cmake:28 (find_package):
  Could not find a package configuration file provided by "Qt5SerialPort"
  with any of the following names:

    Qt5SerialPortConfig.cmake
    qt5serialport-config.cmake

  Add the installation prefix of "Qt5SerialPort" to CMAKE_PREFIX_PATH or set
  "Qt5SerialPort_DIR" to a directory containing one of the above files.  If
  "Qt5SerialPort" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  CMakeLists.txt:149 (find_package)


-- Configuring incomplete, errors occurred!

5.11 libqt5x11extras5-dev库问题

$ sudo apt-get install libqt5x11extras5-dev
CMake Error at /usr/lib/aarch64-linux-gnu/cmake/Qt5/Qt5Config.cmake:28 (find_package):
  Could not find a package configuration file provided by "Qt5X11Extras" with
  any of the following names:

    Qt5X11ExtrasConfig.cmake
    qt5x11extras-config.cmake

  Add the installation prefix of "Qt5X11Extras" to CMAKE_PREFIX_PATH or set
  "Qt5X11Extras_DIR" to a directory containing one of the above files.  If
  "Qt5X11Extras" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  libs/qmlglsink/CMakeLists.txt:26 (find_package)


-- Configuring incomplete, errors occurred!

5.12 cmake版本问题

cmake必须是3.22版本以上才能进行配置、编译。

$ sudo apt-get remove --purge cmake
$ tar -zxvf cmake-3.22.1.tar.gz
$ cd cmake-3.22.1
$ ./bootstrap
$ make
$ sudo make install
$ cmake --version

5.13 修改CMakeList.txt

$ git diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 765e4f450..89a3625d2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,6 +37,10 @@ include(CMakePrintHelpers)

 set(CMAKE_CXX_STANDARD 17)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(OpenGL_GL_PREFERENCE "GLVND")
+set(CMAKE_PREFIX_PATH "/path/to/install")
+
+
 if(LINUX)
     set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/AppDir/usr)
 else()
  • 22
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值