Cross-compile to RPi WITHOUT (RE)COMPILE QT from source
-
Hi Everyone!
After a lot of unsuccessful tries I compiled qt 5.15.0 from source on Ubuntu 20.04 (WSL) for cross-compilation to RPi 3B+ (working howto: https://github.com/UvinduW/Cross-Compiling-Qt-for-Raspberry-Pi-4 - but I changed some steps for rpi3 of course).
The ./configure finished within minutes, but make -j4 took more than 20 hours (not minutes, hours) on a business class laptop (16GB ram, i7-7700HQ 2.8GHz CPU...).Unfortunatelly every of my colleges have to rebuild qmake executable according to the built-in variables (ref.: https://doc.qt.io/qt-5/qmake-environment-reference.html) OR the folder structure have to be the same on every work-stations...
To avoid this, we started to try to change built-in variables, but the qmake.conf structure is not clean enough and qmake -set PROPERTY VALUE not works:
...@...:/mnt/c/_work/xcompile/rpi$ ./qt5.15_mod/bin/qmake -query QT_SYSROOT:/mnt/c/_work/xcompile/rpi/sysroot QT_INSTALL_PREFIX:/mnt/c/_work/xcompile/rpi/qt5.15_mod QT_INSTALL_PREFIX/dev:/usr/local/qt5.15 QT_INSTALL_ARCHDATA:/mnt/c/_work/xcompile/rpi/qt5.15_mod QT_INSTALL_ARCHDATA/dev:/usr/local/qt5.15 ... QT_HOST_PREFIX:/mnt/c/_work/xcompile/rpi/qt5.15_mod QT_HOST_DATA:/mnt/c/_work/xcompile/rpi/qt5.15_mod QT_HOST_BINS:/mnt/c/_work/xcompile/rpi/qt5.15_mod/bin QT_HOST_LIBS:/mnt/c/_work/xcompile/rpi/qt5.15_mod/lib QMAKE_SPEC:linux-g++ QMAKE_XSPEC:devices/linux-rasp-pi3-g++ QMAKE_VERSION:3.1 QT_VERSION:5.15.0 ...@...:/mnt/c/_work/xcompile/rpi$ ./qt5.15_mod/bin/qmake -set QT_SYSROOT ../sysroot ...@...:/mnt/c/_work/xcompile/rpi$ ./qt5.15_mod/bin/qmake -query QT_SYSROOT:../sysroot QT_SYSROOT:/mnt/c/_work/xcompile/rpi/sysroot QT_INSTALL_PREFIX:/mnt/c/_work/xcompile/rpi/qt5.15_mod QT_INSTALL_PREFIX/dev:/usr/local/qt5.15 QT_INSTALL_ARCHDATA:/mnt/c/_work/xcompile/rpi/qt5.15_mod QT_INSTALL_ARCHDATA/dev:/usr/local/qt5.15 ... QMAKE_SPEC:linux-g++ QMAKE_XSPEC:devices/linux-rasp-pi3-g++ QMAKE_VERSION:3.1 QT_VERSION:5.15.0 ...@...:/mnt/c/_work/xcompile/rpi$ ./qt5.15_mod/bin/qmake -query QT_SYSROOT /mnt/c/_work/xcompile/rpi/sysroot
QMake configuration reference says, the changed variables are stored in a QSettings object, but... how? Which qmake.conf files are used by qmake (I think the mkspec/device/... and the mkspec/linux... ones and the included ones)?
[Moreover: Why have to I compile qt? Libraries, runnables are available in the syncronized sysroot folder from RPi (if qt is installed on it) and/or inside the installed qt on the host computer (actually Ubuntu on WSL) and/or inside the cross-compile toolchain(s).
Can I override the qmake's built-in variables somehow (with a custom qmake.conf file or by using qmake -set ...)? Is it enough to cross-compile? If not, why not?] -
I created a qt.conf file with the following:
[General] QT_SYSROOT=xyz [Paths] QT_SYSROOT=xyz Prefix=..
After that, qmake -query returns with:
QT_SYSROOT: QT_INSTALL_PREFIX:/mnt/c/_work/xcompile/rpi/qt5.15_mod QT_INSTALL_ARCHDATA:/mnt/c/_work/xcompile/rpi/qt5.15_mod QT_INSTALL_DATA:/mnt/c/_work/xcompile/rpi/qt5.15_mod QT_INSTALL_DOCS:/mnt/c/_work/xcompile/rpi/qt5.15_mod/doc QT_INSTALL_HEADERS:/mnt/c/_work/xcompile/rpi/qt5.15_mod/include QT_INSTALL_LIBS:/mnt/c/_work/xcompile/rpi/qt5.15_mod/lib QT_INSTALL_LIBEXECS:/mnt/c/_work/xcompile/rpi/qt5.15_mod/libexec QT_INSTALL_BINS:/mnt/c/_work/xcompile/rpi/qt5.15_mod/bin QT_INSTALL_TESTS:/mnt/c/_work/xcompile/rpi/qt5.15_mod/tests QT_INSTALL_PLUGINS:/mnt/c/_work/xcompile/rpi/qt5.15_mod/plugins QT_INSTALL_IMPORTS:/mnt/c/_work/xcompile/rpi/qt5.15_mod/imports QT_INSTALL_QML:/mnt/c/_work/xcompile/rpi/qt5.15_mod/qml QT_INSTALL_TRANSLATIONS:/mnt/c/_work/xcompile/rpi/qt5.15_mod/translations QT_INSTALL_CONFIGURATION:/mnt/c/_work/xcompile/rpi/qt5.15_mod QT_INSTALL_EXAMPLES:/mnt/c/_work/xcompile/rpi/qt5.15_mod/examples QT_INSTALL_DEMOS:/mnt/c/_work/xcompile/rpi/qt5.15_mod/examples QT_HOST_PREFIX:/mnt/c/_work/xcompile/rpi/qt5.15_mod QT_HOST_DATA:/mnt/c/_work/xcompile/rpi/qt5.15_mod QT_HOST_BINS:/mnt/c/_work/xcompile/rpi/qt5.15_mod/bin QT_HOST_LIBS:/mnt/c/_work/xcompile/rpi/qt5.15_mod/lib QMAKE_SPEC:linux-g++ QMAKE_XSPEC:devices/linux-rasp-pi3-g++ QMAKE_VERSION:3.1 QT_VERSION:5.15.0
Makefile generation with qmake returs with:
Project MESSAGE: Qt uses sysroot from:
So QT_SYSROOT is really unset, Makefile contains empty sysroots like
-sysroot= -WAll ...
.