How to configure Qt for cross-compilation from Linux to Windows target ?

How to configure Qt for cross-compilation from Linux to Windows target ?

Asked on December 18, 2018 in Qt.
Add Comment


  • 3 Answer(s)

       Use this:

     $ git clone https://github.com/mxe/mxe.git
    

    Apply this link:

    build dependencies

    To Build the  Qt for Windows,  and the cross-build tools; this will take about an hour machine with decent internet access:

    $ cd mxe && make qt
    

    The directory of  app and add the cross-build tools to the PATH environment:

    $ export PATH=<mxe root>/usr/bin:$PATH
    

     the Qt Makefile generator to run the tool :

    $ <mxe root>/usr/i686-pc-mingw32/qt/bin/qmake && make
    

    To  find the binary in the ./release directory:

    $ wine release/foo.exe
    

    Notes:

    • The  Branch of the MXE repository. to get a lot of development team.
    • The output is a 32-bit static binary it   well works  on 64-bit Windows.
    Answered on December 18, 2018.
    Add Comment

    To Built Qt:

    By using the make qt to build Qt,  MXE_TARGETS to control your target machine and toolchain (32- or 64-bit). MXE started using .static and .shared as a part of the target name  which type of lib  to build.

    # The following is the same as `make qt`, see explanation on default settings after the code block.
    make qt MXE_TARGETS=i686-w64-mingw32.static # MinGW-w64, 32-bit, static libs
    # Other targets you can use:
    make qt MXE_TARGETS=x86_64-w64-mingw32.static # MinGW-w64, 64-bit, static libs
    make qt MXE_TARGETS=i686-w64-mingw32.shared # MinGW-w64, 32-bit, shared libs
    # You can even specify two targets, and they are built in one run:
    # (And that's why it is MXE_TARGET**S**, not MXE_TARGET 
    # MinGW-w64, both 32- and 64-bit, static libs
    make qt MXE_TARGETS='i686-w64-mingw32.static x86_64-w64-mingw32.static'
    

     By changing the MXE_TARGETS, the <mxe root>/usr/i686-pc-mingw32/qt/bin/qmake :

    <mxe root>/usr/<TARGET>/qt/bin/qmake
    

     Initialize the  MXE_TARGETS,  to do:

    <mxe root>/usr/i686-w64-mingw32.static/qt/bin/qmake
    
    Answered on December 18, 2018.
    Add Comment

    To run the configure (with -xtarget, etc.),  then runs  the “hosts” gcc to build the local binary file ./bin/qmake:

    ./configure -xplatform win32-g++ -device-option CROSS_COMPILE=$cross_prefix_here -nomake examples ...
    

    They  run normal “make” and it builds it to mingw

      make
    make install
    

    Use:

    • yes.
    • To  use something other than msvcrt.dll (its default). Though  never used anything else so  dono  their certain.
    •  

     

    Answered on December 18, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.