Results 1 to 5 of 5

Thread: How do I compile for linux on windows?

  1. #1
    Join Date
    Dec 2009
    Posts
    11
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Question How do I compile for linux on windows?

    OK, I have two questions which I am having a hard time finding the answers to.

    I have the Qt SDK installed on Windows, but I do not have anything Qt related installed on Linux. (I am running Linux in an emulator). I want to know, is it possible to build a Linux application using the tools I've installed on the windows platform? If so, how can I do it?

    Furthermore, I had recently sent a very simple Qt Application along with the necessary dlls in the same directory to my sister for testing. She reported to me that the program would not run. Even on my system, Qt executables always terminate with an error when the necessary dlls are not in the same directory. From my experience and from what I read, I figured all that was needed is those dlls included with the executable. Apparently that's not the case. Does this mean that for a user to run my qt apps they have to download and install the entire Qt Framework? I'm pretty sure I didn't have Qt installed before I installed Google Earth, and it ran perfectly. So clearly I'm lacking some insight. Can someone help me with this?
    Last edited by waitingforzion; 27th December 2009 at 04:56.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How do I compile for linux on windows?

    Quote Originally Posted by waitingforzion View Post
    I have the Qt SDK installed on Windows, but I do not have anything Qt related installed on Linux. (I am running Linux in an emulator). I want to know, is it possible to build a Linux application using the tools I've installed on the windows platform? If so, how can I do it?
    Not with the ones you currently have. You need a cross-compiler to be able to do that (use your favourite search engine for more details). Alternatively run Linux as a virtual machine on your Windows installation and compile there, it might prove easier than setting up a complete cross-compiling toolchain.

    Furthermore, I had recently sent a very simple Qt Application along with the necessary dlls in the same directory to my sister for testing. She reported to me that the program would not run. Even on my system, Qt executables always terminate with an error when the necessary dlls are not in the same directory. From my experience and from what I read, I figured all that was needed is those dlls included with the executable. Apparently that's not the case.
    Can you quote the exact error?

    Does this mean that for a user to run my qt apps they have to download and install the entire Qt Framework?
    No, of course not. You just need the proper libs.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How do I compile for linux on windows?

    Quote Originally Posted by wysota View Post
    Not with the ones you currently have. You need a cross-compiler to be able to do that (use your favourite search engine for more details). Alternatively run Linux as a virtual machine on your Windows installation and compile there, it might prove easier than setting up a complete cross-compiling toolchain.
    I'll second this. While it is possible to build a cross-compiling set of tools and libraries on Windows to target Linux, it is far more effort than it is likely to be worth unless you are trying to create some sort of build farm for a team to share (even then it may be easier to go Linux > Windows). Install Qt in your Linux virtual machine and build your source there. Place your code into a source control system to allow easy transfer of changes (and there will be some if this is your first attempt) back and forth between Windows and Linux working copies.

  4. #4
    Join Date
    Sep 2009
    Location
    Tashkent, Uzbekistan
    Posts
    107
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How do I compile for linux on windows?

    It doesn't worth to use cross-compile. Build it on a Linux right inside your VM. For the same project tools on both Windows and Linux you can use SVN (for common code base) and QMake/CMake utilities.
    -- Tanuki

    per cauda vel vaculus cauda

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How do I compile for linux on windows?

    Quote Originally Posted by waitingforzion
    Furthermore, I had recently sent a very simple Qt Application along with the necessary dlls in the same directory to my sister for testing. She reported to me that the program would not run. Even on my system, Qt executables always terminate with an error when the necessary dlls are not in the same directory.
    Make sure you are bundling the correct DLLs form the Qt SDK directories. You want the DLL files from the /Qt/2009.03/Qt/bin and plugins directories (or equiv) and not the files in /Qt/2009.03/bin. The latter files are the runtime bundled with the Qt Creator and not the files your application is built against.
    Quote Originally Posted by dhaxelbarqs View Post
    To compile and link application using wxWidgets library, you have to add or change the following locations in the generated project properties.
    wxWidgets?

    You may need to put conditional sections into your PRO file to account for path differences if you have external libraries involved (like Qwt, QCA or wwWidgets) or other differences. Something like:
    Qt Code:
    1. # Platform specific tweaks
    2. unix {
    3. QWTPATH = /usr/local/qwt-5.2.0
    4. }
    5. win32 {
    6. QWTPATH = C:\Qwt-5.2.0
    7. }
    8. INCLUDEPATH += $$QWTPATH/include
    9. LIBS += -L$$QWTPATH/lib -lqwt
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Compilation and distribution
    By cpearson1990 in forum Installation and Deployment
    Replies: 6
    Last Post: 16th July 2009, 15:09

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.