How to cross compile Qt creator application without connecting target platform?



  • Hi all,
    I have created a GUI application using Qt Creator 3.0.1 (Based on Qt 5.2.1 (GCC 4.6.1, 64 bit)) in my Ubuntu 14.04 64bit PC.
    Now, I need to cross compile it for my target platform. I have the cross compiler tool chain for my target platform. One way that I have seen is that, connect the target board using the IP address and run the application directly on the target. This solution will not work for me :(
    What I want is that, cross compile the application in my PC and make the executable ready. I will copy the executable manually to the target platform(s) when I need to try.

    Could anyone help me to set-up Qt creator for above mentioned configuration? How I can configure the Qt Creator for cross compile the application without connecting target platform?

    Thank you in advance,
    Ajith P V



  • This is quite an involved answer (as in there could be quite a few steps). But to get you started in the right direction here are some pointers:

    First you need to create a new "kit":

    • So in your project click projects (on the left-side bar) then select "manage kits", this will open the build & run tab in options.
    • Click the "kits" tab and then click "add". You will have a list of options one of which is the compiler to use and the debugger.
    • Now you need to add a compiler (and optionally a debugger) so click the compiler tab and do the same.
    • Fill in the options with your cross compiler tool chain. Then go back to your new kit and select the compiler that you just made. Then apply that and select ok to close it.
    • Now click the "add kit" drop down and select your new kit. You will see it added next to your desktop kit with its own build / run options. Fill those in as required.

    You can also add your device for loading / debugging. When you are in the manage kits area you will see a device option where you can select your device. To do this you need to add a device. Click the devices tab (on the left below build & run) and you can add your device (including its ip address for etc...).

    Eventually you should be able to pull the whole build / load software within qt. But for now just try to get your compile working.


    Edit: this assumes that you have already cross-compiled the qt frame work! - that should really be the first step. All the qt dll's need to be compiled for your target so you will end up with a qt5.2.1-target version of qt, which you will also have to add in the qt versions tab of the kits page.



  • @code_fodder Thank you for your detailed explanation. I would like to know whether the steps that mentioned will work without adding a physical device to Qt creator? I really don't want to connect the target platform to Qt creator but, need to cross compile the application for the target platform.

    Thank you in advance,
    Ajith P V



  • @Ajith_P_V Yes that is right, you don't need to add the physical device. That was really just an extra option in case that was convenient to you later on : )

    Have a look at creating kits for cross compiling in the qt docs if you can find it! - there are quite a few bits of info out there that may fill in the gaps I have left. I only gave the general steps required.



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