Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
We are cross-compiling our Qt5 application within Yocto/Bitbake using CMake for Cortex ARM 9.
No matter what I do, I can't get Cmake to find the required
Qt5Config.cmake
config file.
The error message is well known out there:
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!
The recipy seems to be fine so far. I depend Qt and use Cmake by:
RDEPENDS_${PN} += " qtconnectivity "
inherit pkgconfig cmake
Unfortunately I am uncertain about two things:
When I build Yocto (on 2 cores), why is bitbake building the qt5
packages before or at the same time as my faulty recipe? Shouldn't the dependency sort this out? I also tried to use DEPENDS
instead of RDEPENDS
, but that doesn't make a difference.
I don't know in which sysroots Qt is being installed. When I do find . -name Qt5Config.cmake
I find so many places. One of the places looks a bit more promising than the others. It is: ./tmp/sysroots-components/cortexa9hf-neon-mx6qdl/qtbase/usr/lib/cmake/Qt5/Qt5Config.cmake
. But still, shouldn't the Qt libs be in the sysroot of "my recipe"?
So, after all, I try to let CMake
know the location of Qt5Config.cmake
. I try by setting
export Qt5_DIR = "/home/vagrant/build/tmp/sysroots-components/cortexa9hf-neon-mx6qdl/qtbase/usr/lib/cmake/Qt5/"
in the recipe and can confirm with a CMake output that it knows the path Qt5_DIR
. Also setting the path in CMake (with set(Qt5_DIR ...)
) doesn't help.
The path remains unknown. Even if I would be happy now to make CMake understand where Qt5 is - there seems to be a misconfiguration, as I would assume that Qt should be known to my recipe automatically.
What else can I try?
Finally got around to answering. I had the same issue for awhile and discovered the cmake_qt5 bitbake class.
Using this class in place of cmake
should populate all the necessary flags needed to use Qt5 with CMake in the Yocto Project.
–
–
–
–
you just need to inherit class cmake_qt5 and make sure that you assigned do_install() like that
# Recipe created by recipetool
# This is the basis of a recipe and may need further editing in order to be fully functional.
# (Feel free to remove these comments when editing.)
# Unable to find any files that looked like license statements. Check the accompanying
# documentation and source headers and set LICENSE and LIC_FILES_CHKSUM accordingly.
# NOTE: LICENSE is being set to "CLOSED" to allow you to at least start building - if
# this is not accurate with respect to the licensing of the software being built (it
# will not be in most cases) you must specify the correct value before using this
# recipe for anything other than initial testing/development!
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""
S="${WORKDIR}"
SRC_URI = "file://login.tar"
DEPENDS += "qtbase wayland"
# NOTE: unable to map the following CMake package dependencies: Qt QT
inherit cmake
inherit cmake_qt5
# Specify any options you want to pass to cmake using EXTRA_OECMAKE:
EXTRA_OECMAKE = ""
do_install(){
install -d ${D}${sbindir}
install -m 0755 ${WORKDIR}/build/login_system ${D}${sbindir}/login_system
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.