Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to cross-compile qt5.9.5 to SDR board ?



  • I have already cross-compiled my qt4.8.7 to SDR board AD9361 it is working fine but due to some limitation of this version I need to migrate to qt 5. Now I have Qt5.9.5 in Desktop, I have to cross-compile this version to my SDR board. I tried myself cross-compile this version following similar steps as qt 4.8.7 but ./ configuration is not successful.

    For qt4.8.7 cross-compilation I have followed the following websites:

    https://wiki.qt.io/RaspberryPi2EGLFS
    https://mechatronicsblog.com/cross-compile-and-deploy-qt-5-12-for-raspberry-pi/
    https://forum.qt.io/topic/52546/tuto-build-qt-to-cross-compile-for-arm/2


  • Lifetime Qt Champion

    @Mijaz said in How to cross-compile qt5.9.5 to SDR board ?:

    but ./ configuration is not successful

    Please provide more information: what exactly was not successful? What errors did you get?



  • @jsulm
    I have executed the command:

    /home/ijaz/myQT5Root/qt-everywhere-opensource-src-5.9.5/qtbase/configure -top-level -opensource -confirm-license -prefix /usr/local/Qt-5.9.5-arm -embedded arm -little-endian -no-pch -xplatform linux-arm-gnueabihf-g++
    
    Creating qmake...
    .Done.
    /home/ijaz/myQT5Root/qt-everywhere-opensource-src-5.9.5/qtbase/mkspecs/features/resolve_config.prf:25: 'addExclusiveBuilds' is not a recognized test function.
    /home/ijaz/myQT5Root/qt-everywhere-opensource-src-5.9.5/qtbase/mkspecs/features/resolve_config.prf:37: 'addExclusiveBuilds' is not a recognized test function.
    /home/ijaz/myQT5Root/qt-everywhere-opensource-src-5.9.5/qtbase/mkspecs/features/qt.prf:16: 'qtConfig' is not a recognized test function.
    Project WARNING: CONFIG-=import_qpa_plugin is deprecated. Use QTPLUGIN.platforms=- instead.
    Project ERROR: Unknown module(s) in QT: core gui
    

    Selection_035.png


  • Lifetime Qt Champion

    @Mijaz Please don't post screen-shots!
    Copy the text from console and post the text here.
    You should not build inside the Qt source code! Create a build directory somewhere outside of Qt source code tree and call configure from there.
    Also, why don't you use recent Qt5 version?



  • @jsulm

    root@ijaz-HP-ProDesk-400-G4-MT:~# /home/ijaz/myQT5Root/qt-everywhere-opensource-src-5.9.5/qtbase/configure -top-level -opensource -confirm-license -prefix /usr/local/Qt-5.9.5-arm -embedded arm -little-endian -no-pch -xplatform linux-arm-gnueabihf-g++
    You cannot make a shadow build from a source tree containing a previous build.
    Cannot proceed.
    

    I think for the latest version I need the latest toolchain which will not support my board OS.


  • Lifetime Qt Champion

    @Mijaz said in How to cross-compile qt5.9.5 to SDR board ?:

    You cannot make a shadow build from a source tree containing a previous build

    That's why I suggested to build OUTSIDE of the Qt source tree: to keep it clean.
    Now, checkout Qt source code again, create a build directory, go that directory and call configure from there.

    mkdir qt_build
    cd qt_build
    PATH_TO_YOUR_QT/qtbase/configure ...
    


  • @jsulm
    Now I have installed the latest version qt-5.12.5. But ./Configuration error still not resolved.

     ./configure -debug-and-release -device linux-arm-generic- -device-option CROSS_COMPILE=~/home/ijaz/myQT5Root/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-g++ -sysroot ~/home/ijaz/myQT5Root/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt512 -no-use-gold-linker -v -no-gbm
    Creating qmake...
    make: Nothing to be done for 'first'.
    Command line: -debug-and-release -device linux-arm-generic- -device-option CROSS_COMPILE=/home/ijaz/home/ijaz/myQT5Root/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-g++ -sysroot /home/ijaz/home/ijaz/myQT5Root/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt512 -no-use-gold-linker -v -no-gbm
    Project ERROR: Cannot run target compiler '/home/ijaz/home/ijaz/myQT5Root/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-g++g++'. Output:
    ===================
    ===================
    Maybe you forgot to setup the environment?
    
    

  • Lifetime Qt Champion

    @Mijaz said in How to cross-compile qt5.9.5 to SDR board ?:

    ./configure

    You're again calling configure from the Qt source directory. Why?

    "installed the latest version qt-5.12.5" - do you mean you checked out Qt 5.12.5 from Git or downloaded its source code as tar.gz archive? So, what exactly did you download?



  • @jsulm
    I have maked directory by:
    cd mkdir qt_build
    cd qt_build

    ijaz@ijaz-HP-ProDesk-400-G4-MT:~/qt_build$  ./configure -debug-and-release -device linux-arm-generic- -device-option CROSS_COMPILE=~/home/ijaz/myQT5Root/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf- -sysroot ~/home/ijaz/myQT5Root/sysroot -opensource -confirm-license -make libs -prefix /media/ijaz/EA82822F8281FFF5/qt5_12/5.12.5/gcc_64 -no-use-gold-linker -v -no-gbm
    bash: ./configure: No such file or directory
    

    I have downloaded the "qt-opensource-linux-x64-5.12.5.run" and installed
    Now I have the Qt 5.12.5 version

    Selection_036.png


  • Lifetime Qt Champion

    @Mijaz You should learn the basics: how to execute a command in terminal using an absolute ot relative path.
    And you should read what others write more carefully - I already provided an example how to do this. Here once more:

    mkdir qt_build
    cd qt_build
    PATH_TO_YOUR_QT/qtbase/configure ...
    

    "I have downloaded the "qt-opensource-linux-x64-5.12.5.run" and installed" - you installed Qt binaries I guess, if you want to compile Qt you need to install Qt source code of course.



  • @jsulm

    ijaz@ijaz-HP-ProDesk-400-G4-MT:~/myQT5Root/qt-everywhere-src-5.12.5$ ./configure+ cd qtbase
    + /home/ijaz/myQT5Root/qt-everywhere-src-5.12.5/qtbase/configure -top-level 
    Creating qmake...
    ...........................................................................................Done.
    Info: creating super cache file /home/ijaz/myQT5Root/qt-everywhere-src-5.12.5/.qmake.super
    Info: creating cache file /home/ijaz/myQT5Root/qt-everywhere-src-5.12.5/.qmake.cache
    /home/ijaz/myQT5Root/qt-everywhere-src-5.12.5/qtbase/mkspecs/features/qt_configure.prf:2300: Error parsing JSON at 1:1: illegal value
    Project ERROR: Invalid or non-existent file /home/ijaz/myQT5Root/qt-everywhere-src-5.12.5/qtdeclarative/configure.json.
    
    

  • Lifetime Qt Champion

    @Mijaz Now you're again compiling inside Qt source code directory! WHY?!
    AGAIN:

    mkdir qt_build
    cd qt_build
    ~/myQT5Root/qt-everywhere-src-5.12.5/configure ...
    

    So, you go to your build directory and call configure from Qt source code directory using a whole path to it...



  • @jsulm

    ijaz@ijaz-HP-ProDesk-400-G4-MT:~/qt_build$ ~/myQT5Root/qt-everywhere-src-5.12.5/configure -release -device linux-arm-generic-g++ -device-option CROSS_COMPILE=~/myQT5Root/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf- -sysroot ~/myQT5Root/sysroot -opensource -confirm-license -skip qtwayland -skip qtlocation -skip qtscript -make libs -prefix /usr/local/qt5_12 -no-use-gold-linker -v -no-gbm
    + cd qtbase
    + /home/ijaz/myQT5Root/qt-everywhere-src-5.12.5/qtbase/configure -top-level -release -device linux-arm-generic-g++ -device-option CROSS_COMPILE=/home/ijaz/myQT5Root/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf- -sysroot /home/ijaz/myQT5Root/sysroot -opensource -confirm-license -skip qtwayland -skip qtlocation -skip qtscript -make libs -prefix /usr/local/qt5_12 -no-use-gold-linker -v -no-gbm
    Performing shadow build...
    Preparing build tree...
    Creating qmake...
    make: Nothing to be done for 'first'.
    Command line: -release -device linux-arm-generic-g++ -device-option CROSS_COMPILE=/home/ijaz/myQT5Root/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf- -sysroot /home/ijaz/myQT5Root/sysroot -opensource -confirm-license -skip qtwayland -skip qtlocation -skip qtscript -make libs -prefix /usr/local/qt5_12 -no-use-gold-linker -v -no-gbm
    
    This is the Qt Open Source Edition.
    
    You have already accepted the terms of the Open Source license.
    
    Running configuration tests...
    
    + /home/ijaz/myQT5Root/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-g++ -dumpmachine
    > arm-linux-gnueabihf
    Checking for valid makespec... 
    + cd /home/ijaz/qt_build/config.tests/verifyspec && /home/ijaz/qt_build/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_CFLAGS += --sysroot=/home/ijaz/myQT5Root/sysroot" "QMAKE_CXXFLAGS += --sysroot=/home/ijaz/myQT5Root/sysroot" "QMAKE_LFLAGS += --sysroot=/home/ijaz/myQT5Root/sysroot" -early "CONFIG += cross_compile" /home/ijaz/myQT5Root/qt-everywhere-src-5.12.5/qtbase/config.tests/verifyspec
    + cd /home/ijaz/qt_build/config.tests/verifyspec && MAKEFLAGS= /usr/bin/make clean && MAKEFLAGS= /usr/bin/make
    > rm -f verifyspec.o
    > rm -f *~ core *.core
    > /home/ijaz/myQT5Root/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-g++ -c -pipe -mfloat-abi=softfp --sysroot=/home/ijaz/myQT5Root/sysroot -O2 -std=gnu++11 -w -fPIC  -I/home/ijaz/myQT5Root/qt-everywhere-src-5.12.5/qtbase/config.tests/verifyspec -I. -I/home/ijaz/myQT5Root/qt-everywhere-src-5.12.5/qtbase/mkspecs/devices/linux-arm-generic-g++ -o verifyspec.o /home/ijaz/myQT5Root/qt-everywhere-src-5.12.5/qtbase/config.tests/verifyspec/verifyspec.cpp
    > /home/ijaz/myQT5Root/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-g++ -mfloat-abi=softfp --sysroot=/home/ijaz/myQT5Root/sysroot -Wl,-O1 -o verifyspec verifyspec.o      
    > /home/ijaz/myQT5Root/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.2/../../../../arm-linux-gnueabihf/bin/ld: error: verifyspec uses VFP register arguments, verifyspec.o does not
    > /home/ijaz/myQT5Root/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.2/../../../../arm-linux-gnueabihf/bin/ld: failed to merge target specific data of file verifyspec.o
    > collect2: error: ld returned 1 exit status
    > Makefile:68: recipe for target 'verifyspec' failed
    > make: *** [verifyspec] Error 1
    Note: Also available for Linux: linux-clang linux-icc
    
    ERROR: Cannot compile a minimal program. The toolchain or QMakeSpec is broken.
    
    

    Note: Because I am using the SDR board and that board is not included in the device list so I have used Linux-arm-generic-g++.


  • Lifetime Qt Champion

    @Mijaz said in How to cross-compile qt5.9.5 to SDR board ?:

    Note: Because I am using the SDR board and that board is not included in the device list so I have used Linux-arm-generic-g++.

    I'm not sure, but my guess is that you have to to adapt that mkspec for your device.
    "error: verifyspec uses VFP register arguments, verifyspec.o does not" - it looks like different ABI is used.


  • Lifetime Qt Champion

    Hi,

    Is there any mkspec that closely matches your board ?
    If so copy it and customize it so it fits your device.


Log in to reply