2

我们正在使用适用于 Cortex ARM 9 的 CMake 在 Yocto/Bitbake 中交叉编译我们的 Qt5 应用程序。

无论我做什么,我都无法让 Cmake 找到所需的Qt5Config.cmake配置文件。

错误消息是众所周知的:

 CMake Error at CMakeLists.txt:71 (find_package):
 By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has
 asked CMake to find a package configuration file provided by "Qt5", but
 CMake did not find one.

 Could not find a package configuration file provided by "Qt5" with any of
 the following names:

     Qt5Config.cmake
     qt5-config.cmake

 Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
 to a directory containing one of the above files.  If "Qt5" provides a
 separate development package or SDK, be sure it has been installed.

 -- Configuring incomplete, errors occurred!

到目前为止,recipy 似乎还不错。我依赖 Qt 并通过以下方式使用 Cmake:

RDEPENDS_${PN} += " qtconnectivity "
inherit pkgconfig cmake

不幸的是,我不确定两件事:

  1. 当我构建 Yocto(在 2 个内核上)时,为什么 bitbakeqt5在我的错误配方之前或同时构建包?依赖项不应该解决这个问题吗?我也尝试使用DEPENDS而不是RDEPENDS,但这并没有什么不同。

  2. 我不知道 Qt 安装在哪个 sysroots 中。当我这样做时,find . -name Qt5Config.cmake我会发现很多地方。其中一个地方看起来比其他地方更有希望。它是:./tmp/sysroots-components/cortexa9hf-neon-mx6qdl/qtbase/usr/lib/cmake/Qt5/Qt5Config.cmake。但是,Qt 库不应该在“我的食谱”的 sysroot 中吗?

所以,毕竟,我试图让CMake知道的位置Qt5Config.cmake。我尝试通过设置

export Qt5_DIR = "/home/vagrant/build/tmp/sysroots-components/cortexa9hf-neon-mx6qdl/qtbase/usr/lib/cmake/Qt5/"

在配方中,并且可以通过 CMake 输出确认它知道路径Qt5_DIR。在 CMake 中设置路径(使用set(Qt5_DIR ...))也无济于事。

路径仍然未知。即使我现在很高兴让 CMake 了解 Qt5 在哪里 - 似乎存在错误配置,因为我认为 Qt 应该自动被我的配方知道。

我还能尝试什么?

4

1 回答 1

3

终于有时间来回答了。我有一段时间遇到同样的问题并发现了cmake_qt5 bitbake 类。

使用此类代替cmake应该填充在 Yocto 项目中使用 Qt5 和 CMake 所需的所有必要标志。

于 2018-07-31T00:29:15.293 回答