Build Qt on Linux, build Qt application on Windows, for an embedded target
I've build Qt 5.3.1 for our embedded target on Linux.
We would like to develop from Qt Creator in Windows.
However, when setting up the kit in Creator, I'm required to point it at a qmake.exe. However, the qmake that was created is a Linux executable and obviously can't be used in Creator on Windows.
What is the recommended way to make this work?
If I rebuild Qt under Windows for my embedded target, will I run into issues using the Windows qmake.exe on my development machine, but then running my application with the libraries on my target that were developed on a Linux machine?
qmake is independent of the target in the sense that it's host tool to help setup things. qmake is built for the host that it will run on, the fact that the target runs e.g. android, iOS or a linux flavor doesn't matter.
I disagree. Let me explain why.
When setting up the kit in Creator, part of that is selecting the compiler, the debugger, the Qt version, etc. Now, I've created a new kit and pointed it to my GCC based Linaro ARM cross compiler.
In order to specify the Qt version, I have to point Creator at a qmake.exe file. This is the file I do not have because the Qt libraries were built for my embedded ARM system on Linux, and therefore qmake is a Linux executable.
If I attempt to instead point Qt at, say, the MinGW qmake.exe, I get an error from Creator saying "The compiler 'Linaro GCC' (arm-linux-generic-elf-32-bit) cannot produce code for the Qt version 'Qt 5.3 MinGW 32bit' (x86-windows-msyspe-32bit)."
This right here indicates that I need a proper qmake.exe. This could be solved by building the Qt libraries for my target on Windows, but that's a whole new set of issues.
Then we don't disagree at all, I might have given a bit a short explanation but the finality is the same: qmake is built for the host OS. It was implying that a linux cross-compiled Qt's qmake cannot run on windows. You could have some luck trying to also cross-compile qmake from linux to windows but I don't know what amount of work it would require and it it's possible at all.
Well, in addition to simply compiling qmake, all the information that is built into qmake that describes the Qt version, target architecture, etc., has to be determined and built into it.
What is really strange to me is that Qt is supposed to be very portable, but the development environment itself doesn't seem to be. I have a toolchain that produces identical code from either Linux or Windows. Building the Qt libraries for a different architecture on Windows is much more difficult that on Linux (and the lack of documentation on the web supports this, unless the lack of documentation is the reason for the difficulty...).
I would think that Qt would generate some sort of configuration file that holds this information and could be taken to a different system and possibly different OS so application could be developed there.
But this information is built into a platform dependent executable?
Cross-compiling on Windows for linux has never been something easy (and Windows is not the most developer friendly OS) that's why most developers uses a VM with linux if they have to do embedded linux development and can't change their host OS.
The mkspecs can be used to tell qmake which platform you are going to use.
[quote author="SGaist" date="1406756366"]The mkspecs can be used to tell qmake which platform you are going to use.[/quote]
That still doesn't help me get a kit set up in Creator, unless you can tell me how to tell creator to use a specific mkspec instead of the one built into qmake (like there seems to be):
!http://i.imgur.com/1APjHjx.png(Creator kit setup screenshot)!
The last linedit is for the mkspec
It's not that simple.
- qmake.exe has paths, ABI, mkspec, etc., all hard coded in the executable. Run something like "strings qmake" and grep for one of the settings obtained by "qmake -query". They're in there.
- Specifying a mkspec in that dialog does not do enough to solve the problem. In fact, even though my kit has my Linaro cross compiler set up, it still calls MinGW's compiler and I end up with a Windows binary.
- The qmake settings can be modified (using "qmake -set"). I tried to take the MinGW qmake.exe that is installed with Creator and change its settings to match those from the Linux build, but this does not work.