filed to cross compile QT using arm-linux-gnueabihf-gcc
-
wrote on 25 Aug 2023, 02:57 last edited by baklai
My platform is windows, using mingw. When cross-compiling the arm version of qt, if configure does not add -sysroot, it will report "ERROR: Cannot compile a minimal program. The toolchain or QMakeSpec is broken". But after adding -sysroot, the result of Checking for host architecture is arm. The host architecture should be x86.
not add -sysroot
configure ^ -release ^ -opensource ^ -confirm-license ^ -prefix E:/arm32-gcc6.2.1-qt5.13.0 ^ -nomake tests ^ -nomake examples ^ -no-opengl ^ -skip qtvirtualkeyboard ^ -xplatform linux-arm32-gnu-g++ ^ -prefix E:/arm32-gcc6.2.1-qt5.13.0 ^ -recheck-all
An error is reported: Checking for valid makespec... ERROR: Cannot compile a minimal program. The toolchain or QMakeSpec is broken.
add -sysroot
configure ^ -release ^ -opensource ^ -confirm-license ^ -prefix E:/arm32-gcc6.2.1-qt5.13.0 ^ -nomake tests ^ -nomake examples ^ -no-opengl ^ -skip qtvirtualkeyboard ^ -xplatform linux-arm32-gnu-g++ ^ -sysroot E:/lccu3/sysroot ^ -prefix E:/arm32-gcc6.2.1-qt5.13.0 ^ -recheck-all
After adding -sysroot , Running configuration will appear: "Running configuration tests... Checking for machine tuple... yes Checking for valid makespec... yes Checking for target architecture... arm Checking for host architecture... arm" I think that host architecture should be x86
Hope someone can explain why
-
My platform is windows, using mingw. When cross-compiling the arm version of qt, if configure does not add -sysroot, it will report "ERROR: Cannot compile a minimal program. The toolchain or QMakeSpec is broken". But after adding -sysroot, the result of Checking for host architecture is arm. The host architecture should be x86.
not add -sysroot
configure ^ -release ^ -opensource ^ -confirm-license ^ -prefix E:/arm32-gcc6.2.1-qt5.13.0 ^ -nomake tests ^ -nomake examples ^ -no-opengl ^ -skip qtvirtualkeyboard ^ -xplatform linux-arm32-gnu-g++ ^ -prefix E:/arm32-gcc6.2.1-qt5.13.0 ^ -recheck-all
An error is reported: Checking for valid makespec... ERROR: Cannot compile a minimal program. The toolchain or QMakeSpec is broken.
add -sysroot
configure ^ -release ^ -opensource ^ -confirm-license ^ -prefix E:/arm32-gcc6.2.1-qt5.13.0 ^ -nomake tests ^ -nomake examples ^ -no-opengl ^ -skip qtvirtualkeyboard ^ -xplatform linux-arm32-gnu-g++ ^ -sysroot E:/lccu3/sysroot ^ -prefix E:/arm32-gcc6.2.1-qt5.13.0 ^ -recheck-all
After adding -sysroot , Running configuration will appear: "Running configuration tests... Checking for machine tuple... yes Checking for valid makespec... yes Checking for target architecture... arm Checking for host architecture... arm" I think that host architecture should be x86
Hope someone can explain why
Cross-compilation works best and is most tested on Linux. I;d recommend you either switch to Linux or use WSL. Also, Qt 5.13 is very old and unsupported at this point. Can't you at least try with 5.15?
Apart from that, some general points:
- if your device (or a similar one) is in
<qt source dir>/qtbase/mkspecs/devices
then you should use-device
option inconfigure
- it will automatically set up some device-specific flags -sysroot
is definitely required, don't even try to cross-compile without it- on many arm platforms
-no-use-gold-linker
flag helps - you may want to add a device option and point it to your cross compilation toolchain, example:
-device-option CROSS_COMPILE=/path/too/toolchain/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-
Good luck!
- if your device (or a similar one) is in
-
Cross-compilation works best and is most tested on Linux. I;d recommend you either switch to Linux or use WSL. Also, Qt 5.13 is very old and unsupported at this point. Can't you at least try with 5.15?
Apart from that, some general points:
- if your device (or a similar one) is in
<qt source dir>/qtbase/mkspecs/devices
then you should use-device
option inconfigure
- it will automatically set up some device-specific flags -sysroot
is definitely required, don't even try to cross-compile without it- on many arm platforms
-no-use-gold-linker
flag helps - you may want to add a device option and point it to your cross compilation toolchain, example:
-device-option CROSS_COMPILE=/path/too/toolchain/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-
Good luck!
- if your device (or a similar one) is in
1/3