title: How do I configure Qt for cross-compilation from Linux to Windows target?
body: <p>I want to cross compile the Qt libraries (and eventually my application) for a Windows x86_64 target using a Linux x86_64 host machine. I feel like I am close, but I may have a fundamental misunderstanding of some parts of this process.</p>
  
  <p>I began by installing all the mingw packages on my Fedora machine and then modifying the <code>win32-g++</code> qmake.conf file to fit my environment. However, I seem to be getting stuck with some seemingly obvious configure options for Qt: <code>-platform</code> and <code>-xplatform</code>. Qt documentation says that <code>-platform</code> should be the host machine architecture (where you are compiling) and <code>-xplatform</code> should be the target platform for which you wish to deploy. In my case, I set <code>-platform linux-g++-64</code> and <code>-xplatform linux-win32-g++</code> where linux-win32-g++ is my modified win32-g++ configuration.</p>
  
  <p>My problem is that, after executing configure with these options, I see that it invokes my system's compiler instead of the cross compiler (x86_64-w64-mingw32-gcc). If I omit the <code>-xplatform</code> option and set <code>-platform</code> to my target spec (linux-win32-g++), it invokes the cross compiler but then errors when it finds some Unix related functions aren't defined.</p>
  
  <p>Here is some output from my latest attempt: <a href="http://pastebin.com/QCpKSNev" rel="noreferrer">http://pastebin.com/QCpKSNev</a>.</p>
  
  <p>Questions:</p>
  
  <ol>
  <li><p>When cross-compiling something like Qt for Windows from a Linux host, should the native compiler <em>ever</em> be invoked? That is, during a cross compilation process, shouldn't we use <em>only</em> the cross compiler? I don't see why Qt's configure script tries to invoke my system's native compiler when I specify the <code>-xplatform</code> option.</p></li>
  <li><p>If I'm using a mingw cross-compiler, when will I have to deal with a specs file? Spec files for GCC are still sort of a mystery to me, so I am wondering if some background here will help me.</p></li>
  <li><p>In general, beyond specifying a cross compiler in my qmake.conf, what else might I need to consider?</p></li>
  </ol>