Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8776953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:10:50+00:00 2026-06-13T19:10:50+00:00

I want to cross compile the Qt libraries (and eventually my application) for a

  • 0

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.

I began by installing all the mingw packages on my Fedora machine and then modifying the win32-g++ qmake.conf file to fit my environment. However, I seem to be getting stuck with some seemingly obvious configure options for Qt: -platform and -xplatform. Qt documentation says that -platform should be the host machine architecture (where you are compiling) and -xplatform should be the target platform for which you wish to deploy. In my case, I set -platform linux-g++-64 and -xplatform linux-win32-g++ where linux-win32-g++ is my modified win32-g++ configuration.

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 -xplatform option and set -platform 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.

Here is some output from my latest attempt: http://pastebin.com/QCpKSNev.

Questions:

  1. When cross-compiling something like Qt for Windows from a Linux host, should the native compiler ever be invoked? That is, during a cross compilation process, shouldn’t we use only the cross compiler? I don’t see why Qt’s configure script tries to invoke my system’s native compiler when I specify the -xplatform option.

  2. 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.

  3. In general, beyond specifying a cross compiler in my qmake.conf, what else might I need to consider?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:10:51+00:00Added an answer on June 13, 2026 at 7:10 pm

    Just use M cross environment (MXE). It takes the pain out of the whole process:

    • Get it:

      $ git clone https://github.com/mxe/mxe.git
      
    • Install build dependencies

    • Build Qt for Windows, its dependencies, and the cross-build tools;
      this will take about an hour on a fast machine with decent internet access;
      the download is about 500MB:

      $ cd mxe && make qt
      
    • Go to the directory of your app and add the cross-build tools to the PATH environment variable:

      $ export PATH=<mxe root>/usr/bin:$PATH
      
    • Run the Qt Makefile generator tool then build:

      $ <mxe root>/usr/i686-pc-mingw32/qt/bin/qmake && make
      
    • You should find the binary in the ./release directory:

      $ wine release/foo.exe
      

    Some notes:

    • Use the master branch of the MXE repository; it appears to get a lot more love from the development team.

    • The output is a 32-bit static binary, which will work well on 64-bit Windows.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to cross compile my windows/mac/linux application to Qt On Pi 0.2,
I have a cross platform app, I want to compile on Linux. The problem
I want to change linux distro my Development(Host) Machine which I use for embedded
I want to compile static library in linux for windows. Following is the procedure
I'm writing an cross-platform renderer. I want to use it on Windows, Linux, Android,
I have a project written in Lazarus on Windows, but I want to cross-compile
I'm trying to cross compile openldap-2.4.23 on my Ubuntu 10.10 development machine using the
Summary I want to run my cross-compiled application against the 10.5 libraries. Is there
I'm on debian/amd64 and I want to cross-compile GMP for android 2.2 using NDK-7b.
I want to make my C++ project cross platform, and I'm considering using Cygwin/MinGW.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.