[cross_compiling] Does Qt5 supports it from a Microsoft Windows host ? (-platform win32-g++ -xplatform linux-g++-64)

  • Having already cross compiled the Boost development libraries from a Windows host to target Windows, Linux and Mac without problems, I'm feeling the Qt project does not support cross compiling from a Windows host, but instead cross compiling from a Linux host
    But as I'm new to use the Qt project I ask here before going into bug report procedures If anyone attempted the same thing I do (which I admit are a bit experimental)

    I have done multiple attempts targeting Linux but they always failed on Qt5 at the configuration tests stages, while in Qt4 I was able to hack stuffs to let the compilation starts, I'm having troubles to hack in Qt5 to do that, it seems many mkspecs .conf files includes other .conf files and it is a complete puzzle to deal with when cross compiling :(

    My environment

    • Using cmd.exe to build Qt5
    • Carefully checking that sh is not found under any of my PATH env. vars
    • Using Qt5 git development repo on 'stable' branch (Revision: fb66951776e8decb8784c80fb7ed02864253065b Updated submodules. 28/03/2014 02:34:40)
    • Toolchains built with MSYS2 and crosstool-ng fork (diorcety)

    My compilers

    • gcc-4.8.2-x86_64-w64-mingw32
    • gcc-4.8.2-i686-w64-mingw32
    • gcc-4.8.2-x86_64-unknown-linux-gnu
    • gcc-5666.3-x86_64-apple-darwin10
    • clang-3.4-x86_64-apple-darwin10

    Successful cross compilations

    Targets Windows 64-bit seh exception
    @SET PATH=X:/libs/compilers/gcc-4.8.2-x86_64-w64-mingw32/bin;X:/libs/msys64/mingw64/bin;%PATH%
    configure -confirm-license -release -opensource -platform win32-g++ -opengl desktop -shared -no-angle -nomake examples -nomake tests -prefix x:/libs/qt-5_3_0/qt-win64-mgw48

    Targets Windows 32-bit dwarf exception
    @SET PATH=X:/libs/compilers/gcc-4.8.2-i686-w64-mingw32/bin;X:/libs/msys64/mingw32/bin;%PATH%
    configure -confirm-license -release -opensource -platform win32-g++ -opengl desktop -shared -no-angle -nomake examples -nomake tests -prefix x:/libs/qt-5_3_0/qt-win32-mgw48

    Failing cross compilation
    Targets Linux 64-bit
    @SET PATH=X:/libs/compilers/gcc-4.8.2-x86_64-w64-mingw32/bin;X:/libs/compilers/gcc-4.8.2-x86_64-unknown-linux-gnu/bin;X:/libs/msys64/mingw64/bin;%PATH%
    configure -confirm-license -release -opensource -platform win32-g++ -xplatform linux-g++-64 -shared -no-angle -nomake examples -nomake tests -prefix X:/libs/qt-5_3_0/qt-linux64-gcc48 -device-option CROSS_COMPILE=x86_64-unknown-linux-gnu-
    Results in: qmake is made properly for x86_64-w64-mingw32, but the tests fails because it uses Linux shell commands and some win32 gcc options are incompatible with linux gcc options
    @Running configuration tests...
    arch.cpp:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
    process_begin: CreateProcess(NULL, rm -f arch.obj, ...) failed.
    make (e=2): The system cannot find the file specified.
    process_begin: CreateProcess(NULL, rm -f *~ core *.core, ...) failed.
    make (e=2): The system cannot find the file specified.
    process_begin: CreateProcess(NULL, rm -f arch, ...) failed.
    make (e=2): The system cannot find the file specified.
    process_begin: CreateProcess(NULL, rm -f Makefile, ...) failed.
    make (e=2): The system cannot find the file specified.
    x86_64-unknown-linux-gnu-g++: error: command line option '-fno-keep-inline-dllexport' is not supported by this configuration
    x86_64-unknown-linux-gnu-g++: error: unrecognized command line option '-mthreads'
    mingw32-make: *** [arch.o] Error 1
    Could Not Find X:\libs\qt5\qtbase\config.tests\arch\arch.o

    'test' is not recognized as an internal or external command,
    operable program or batch file.
    A subdirectory or file qtbase\ already exists.
    Error occurred while processing: qtbase.
    Makefile:62: recipe for target 'module-qtbase-make_first' failed
    make: *** [module-qtbase-make_first] Error 1@

    One regression I find from Qt4 to Qt5 changes is that in mkspecs/common/unix.conf is loaded include(shell-unix.conf) which will overwritte things set by the MINGW Makefile generator shell-win32.conf

    @QMAKE_TAR = tar -cf
    QMAKE_GZIP = gzip -9f

    QMAKE_COPY = cp -f
    QMAKE_MOVE = mv -f
    QMAKE_DEL_FILE = rm -f
    QMAKE_DEL_DIR = rmdir
    QMAKE_CHK_EXISTS = test -e %1 ||
    QMAKE_CHK_DIR_EXISTS = test -d # legacy
    QMAKE_MKDIR = mkdir -p # legacy
    QMAKE_MKDIR_CMD = test -d %1 || mkdir -p %1

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You should have a look at the "bug report system":http://bugreports.qt-project.org to see if it's something already known.

    You can also ask this on the interest mailing list, you'll find there Qt's developers/maintainers (this forum is more user oriented)

  • I don't think they support windows because I have seen thread here having the same problems and they did not received any reply so it is not even worth to go in the bug reporting system if that's to make a fantom ticket or see some 'won't fix'


    Fixed basic things but then I fail at a regression issue already reported here https://bugreports.qt-project.org/browse/QTBUG-37269 and not categorized as bug but a feature and they are near a won't fix

    So basically my first feelings of WIndows being taken as a 'feature' and not being fully supported is true

  • Lifetime Qt Champion

    Feature rather than bug doesn't mean "won't fix"

    I agree with Oswald about getting it to work.

    On the forum side, there's currently only a few users that have done cross-compilation and probably even less that have done cross-os-compilation. Most of the questions are really targeted on the use of Qt. The questions going with the "internals" are generally best suited for the interest mailing list (note however that I don't say that they should not be posted here, but there's only a few Qt devs that look at this forum)

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.