Qt6 cross compile experience
-
I can not find anything that guides to cross-compile Qt6 for embedded devices except for the laments to complain.
Now cross-compiling Qt6 for any platform is broken and painful:
-
first and foremost, we need to waste time to fully build and install it
for host platform (desktop). Yeah, I know that this was "decided" before TQC
switched, overnight, to cmake, but let's face it, it's a BS needed to cover
the fact that cmake can't build more than one platform at once. -
the cross build installation is broken, instead to copy the tools from the
QT_HOST_TOOLS folder, it creates some scripts that has hardcoded paths to
QT_HOST_TOOLS which runs the scripts from QT_HOST_TOOLS folder. Of course this
makes the installation unusable on another computer. Even the "lib/cmake/Qt6/
qt.toolchain.cmake" contains hardcoded paths... -
there is no way to have a standalone cross build installation, we always
need to ship the whole desktop installation as well (also patch all the files
from cross installation). -
android cross compilation is so crippled now. In Qt 5.x times, we used to
have a nice multi ABI build which built all the android ABIs in one go and it
created a unified Qt SDK for all these ABIs (same as the Android NDK). In Qt 6,
that work was trashed... for the same reason: cmake can't handle multiple
platforms at once... -
android cross compilation in Qt 6 takes more time to build one ABI with
less Qt modules than in Qt5 to build all ABIs and all modules... -
IMHO the qmake build files were removed prematurely ... they should be
removed after cmake matched qmake.
Having said that, I truly believe that cmake is a big step backwards.
Am I the only one who's bother by all these things?We have a huge elephant in the room which nobody want to see it...
Source: https://lists.qt-project.org/pipermail/development/2021-February/041042.html
-
-
@Kevin-Nguyen
I don't know about android, but I'm cross-compiling Qt 6 for Windows, perhaps my cmake steps can help you:
https://github.com/strawberrymusicplayer/strawberry-mxe/blob/master/src/qt6-qtbase.mk
https://github.com/strawberrymusicplayer/strawberry-mxe/blob/master/src/qt6-qttools.mk -
Hi Jonas
I trying to cross-compile Qt6.
I looked on Your work and - and basing on it - i added Qt6 to my project (MiniMyth2).Unfortunately i'm getting https://forum.qt.io/topic/130366/cross-compiling-qt6-moc-cannot-execute-binary-file
Maybe You have some hints for me?
-
@Orocle said in Qt6 cross compile experience:
FIX IT!
Feel free to provide patches to simplify the process
-
@Christian-Ehrlicher well the current problem is obvious. Instead of building the the build tools in step 1 & cross compile Qt in step 2 we now have to build a complete Qt package on the build machine before we can cross compile it. We also have to satisfy all dependencies which we otherwise would use on the build system.
I don't get why someone thought it's a smart move to do it this way, why can't we just compile the necessary tools and then straight complie Qt for the target system, well the same way Qt5 used to compile.
-
I don't get why someone thought it's a smart move to do it this way
One advantage is that there's a clear separation between both builds in the configure system. In the Qt 5 one, some options applied to the host tools, some to the target tools and binaries, and some to both.