How to compile a QT Application targeting for LINUX from a Windows machine



  • I have a QT application created in windows environment. I want the same application to be run on the Linux machine. Please tell the procedure to get this. I want to use my windows machine for compilation and I dont want to use a Linux machine or any VM to do this.



  • What did you try already? Did you google for something like "windows linux cross compile"?



  • I am looking for a standard way provided by QT.



  • Then look no further: there is none. Note that I don't say it's impossible to do, just that Qt (and I assume you mean the Qt SDK) does not provide it.



  • Imho the best way is using a VM or a Remote machine if you dont want to install linux, and you can try using "cygwin":http://www.cygwin.com , but you need to prepare the whole configuration and librarys and im not sure if you can archieve that.



  • I am not whether Qt SDK provides the cross compilation environment yet.



  • [quote author="veeraps" date="1334820343"]I am not whether Qt SDK provides the cross compilation environment yet.[/quote]
    It does not, and also I think that would not make much sense. Even if the source code compiles for Linux, how could it be verified to run?
    From a complexity point of view, I think setting up a Linux machine (VM or not) and the necessary environment for Qt is a whole lot simpler than cross compiling bug hunting afterwards.



  • Added the fact that you will need a real target environment to finally test your application, won't you?



  • "this can be a worst solution" but Qt Creator provides shadow build functionality which can be used to build source for multiple targets.

    bq. The same source code built for and running on multiple targets. Qt Creator allows developers to specify separate build settings for each development platform and to quickly switch between build targets. By default, shadow builds are used to keep the build specific files separate from the source. Developers can create separate versions of project files to keep platform-dependent code separate. They can use qmake scopes to select the file to process depending on which platform qmake is run on.

    Quote reference: "Qt Creator Whitepaper":http://qt-project.org/wiki/QtCreatorWhitepaper



  • What we are trying to say is that while it is possible to solely cross-compile, it is probably not a good way to get the program to actually run properly. But I think the answer is that no Linux cross compiler comes with Qt Creator for Windows, so you will have to get it from somewhere else.



  • Can you provide some names of good cross-compiler with compilation steps.



  • Hi Miroslav,

    The reason why i am trying to use the Windows machine is, we have license only for building qt in windows machine with target for multiple OS. Because of this, i am not looking into the compilation with Linux machine.



  • Hi Jothi,

    [quote author="JothiMurugeswaran" date="1335497329"]The reason why i am trying to use the Windows machine is, we have license only for building qt in windows machine with target for multiple OS. Because of this, i am not looking into the compilation with Linux machine.[/quote]

    That sounds strange. Nobody uses the commercial Qt license these days unless they have to. Unless there are concrete legal reasons that prevent it, you can use the LGPL Qt version on Linux. It actually comes out of the box on most distributions.



  • Strange indeed. I doubt you got yourself a Qt license that does not permit you to build your *nix binaries on *nix itself, but does permit the same on windows. If that's your interperttation of the license, I suggest you read it again and/or contact Digia for an explanation.



  • Hi Jothi,

    [quote author="JothiMurugeswaran" date="1335497167"]Can you provide some names of good cross-compiler with compilation steps.[/quote]

    I doubt you will have success with that here. It is simply something nobody ever does. And building a cross-compiler is not exactly a piece of cake.



  • [quote author="JothiMurugeswaran" date="1335497329"]Hi Miroslav,

    The reason why i am trying to use the Windows machine is, we have license only for building qt in windows machine with target for multiple OS. Because of this, i am not looking into the compilation with Linux machine.[/quote]

    If you're not allowed to build Qt on a Linux machine, then I seriously doubt that you can build on a Windows machine for a Linux target. Cross compiling falls into the same category as running a Linux VM on the Windows box - just IMHO, I'm not a lawyer. If in doubt, contact Digia, as stated already.


Log in to reply
 

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