Cross Build
-
Hello,
I have a project, where I cross compile windows binaries from a docker container which runs linux. Now, I want to add a small GUI that uses qt (makes use of Widgets, Core, and Concurrent). I found a documentation that instructs me to first have a minimum qt host installation using:/qt/configure -developer-build -nomake testsUnfortunately this build creates some warnings that are probably new in gcc 16.1 (-Werror=maybe-uninitialized, -Wsfinae-incomplete=). and as the compiler is configured to treat warnings as errors, the build fails.
I tried to find other minimal qt host installations like:
/qt/configure -no-prefix -init-submodules -submodules qttools -releaseWhich allows me later, to build the cross build qt library:
cmake -S .. -B . \ -DCMAKE_TOOLCHAIN_FILE=/toolchain-mingw64.cmake \ -DQT_HOST_PATH=/QtHostBuild/ \ -DQT_HOST_PATH_CMAKE_DIR=/QtHostBuild/qtbase/ \ -DQT_BUILD_SUBMODULES=qtbase \ -G Ninja cmake --build . --parallel cmake --install .But this also fails later, when I try to build my little project against Qt:
find_package(Qt6 REQUIRED COMPONENTS Widgets Concurrent CONFIG)Results in `Qt6WidgetsToolsConfig.cmake´ not being found, when dependencies of Qt6Widgets are resolved.
What are submodules and which submodules do I need to specify in the build, to have access to the components Widgets and Concurrent?
TIA
TorstenVersion used: 6.11.1
compiler gcc 16.1. -
Problem solved, I had to (of cause) tell the build, that the host tools are outside of the scope of the build, by setting
QT_HOST_PATH. -
Hi and welcome to devnet,
Glad you found out and thanks for sharing.
One thing, don't use the
-developer-buildunless you plan to hack on Qt itself. -
According to the official documentation, I should use it for cross builds: https://doc.qt.io/qt-6/cross-compiling-qt.html
-
Right ! Sorry, I had your host and target build mixed.
For other readers, there's also this important note about the minimal host build suggested there:
This build won't be suitable for developing Qt programs for your host platform, but it will contain the tools necessary to cross-build Qt.