Cross-compilation



  • I am trying to cross-compile a Qt GUI project from my Ubuntu VM on a Windows host to my BBB Wireless board. Qt Creator seems to be set up fine, also the toolchain except Qt version for ARM. I am able to deploy the binary successfully on my target, but its x86-64 architecture and not ARM as expected. My question is how can i get a qmake which is ARM specefic and not gcc generic. I went online and saw a few tutorials, most of them suggested changing the corresponding qmake.conf file, in this case ARm and doing a ./configure. but it is not possible for me since i installed Qt creator from a .run file which implicitly installed Qt as well.

    Edit1:
    Ubuntu version: 16.04

    Ubuntu_terminal:~qtchooser -l
    
    4
    5
    default
    qt4-x86_64-linux-gnu
    qt4
    qt5-x86_64-linux-gnu
    qt5
    

    Beaglebone OS: Debian

    BBB_terminal:~qtchooser -l
    4
    5
    default
    qt4-arm-linux-gnueabihf
    qt4
    qt5-arm-linux-gnueabihf
    qt5
    


  • @abtom87 I guess you may already looked at this guide but just in case, maybe repeating the steps again... This post, although not specific for your device, may help understanding what people is doing while cross-compiling Qt. In that post you'll also find some links to cross-compiling for other ARM devices (i.e. Raspberry Pi)



  • Now i read the reply regarding TI board, sysroot also specified now, the binary deployed is still not ARM compatible. i copied the entire rootfs folder of BBB on my VM ubuntu and thats my sysroot now in Qtcreator, no luck.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Did you cross-compile Qt for your target ?



  • @SGaist No sir, not yet, i am guessing i need to download the latest qt-base and build it.



  • I downloaded qtbase 5.6 from git and tried to build using

    ./configure -embedded arm -xplatform mkspecs/linux-arm-gnueabi-g++
    

    and this is the output:

    -embedded: invalid command-line switch
    arm: unknown argument
    
    

    Once i removed embedded and arm, i get the following output:

    /qtbase-5.6$ ./configure -opensource -confirm-license -xplatform mkspecs/linux-arm-gnueabi-g++ 
    
    This is the Qt Open Source Edition.
    
    You are licensed to use this software under the terms of
    the GNU Lesser General Public License (LGPL) version 2.1.
    You are also licensed to use this software under the terms of
    the GNU Lesser General Public License (LGPL) version 3.
    
    You have already accepted the terms of the Open Source license.
    
    Running configuration tests (phase 1)...
    Done running configuration tests.
    Creating qmake...
    .In file included from /home/abel/Downloads/qtbase-5.6/qmake/library/qmake_global.h:37:0,
                     from /$HOME/qtbase-5.6/qmake/library/qmakeparser.h:37,
                     from /$HOME/qtbase-5.6/qmake/library/qmakeevaluator.h:41,
                     from /$HOME/qtbase-5.6/qmake/project.h:37,
                     from /$HOME/qtbase-5.6/qmake/project.cpp:34:
    ../src/corelib/global/qglobal.h:75:37: fatal error: QtCore/qsystemdetection.h: No such file or directory
    compilation terminated.
    make: *** [project.o] Error 1
    
    


  • Soooo,
    After ,many painstaking hours and going through countless tutorials, I finally managed to cross-compile my Qt on my VM, now I can Deploy the correct binary on my BBB. :)

    I installed the Qtcreator from the .run file and I said I want the source files also along with it. After installation, I tried various things with ./configure , until I executed this:

    ./configure -v -opensource -confirm-license -prefix /opt/qt  -device-option CROSS_COMPILE=$HOME/Downloads/gcc-linaro-6.4.1-2017.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -device linux-beagleboard-g++
    

    I did not have to mention sysroot, which seems to be a bit strange.
    After that I did make and make install of course. I had to restart Qtcreator and specify Qt for ARM in the right place and I am all good. :)


  • Moderators

    @abtom87 said in Cross-compilation:

    I installed the Qtcreator from the .run file and I said I want the source files also along with it

    I guess you mean Qt, not QtCreator?

    "I had to restart Qtcreator" - it's not needed to restart QtCreator to add new Qt installation.



  • yes you're right , i did not "have" to restart the Qt creator, since you just add the location of corresponding qmake.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.