Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-29426

Qt5 can't be cross-compiled from non-x86 to mingw win32/win64

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 5.3.0 Alpha
    • 5.0.0, 5.0.1
    • Core: Other
    • None
    • 34821e226a94858480e57bb25ac7655bfd19f1e6

    Description

      In https://bugzilla.redhat.com/show_bug.cgi?id=905863 a bug was reported where one of the maintainers of the s390 and ppc versions of Fedora Linux tried to get Qt5 cross-compiled for the win32 and win64 target.

      The point at where the build fails is:

      g++ -c -pipe -ffunction-sections -O2 -std=c++0x -Wall -W -D_REENTRANT -fPIC -fno-exceptions -DQT_NO_LIBUDEV -DQT_NO_EVDEV -DQT_NO_XCB -DQT_BOOTSTRAPPED -DQT_LITE_UNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CODECS -DQT_NO_DATASTREAM -DQT_NO_LIBRARY -DQT_NO_QOBJECT -DQT_NO_SYSTEMLOCALE -DQT_NO_THREAD -DQT_NO_UNICODETABLES -DQT_NO_USING_NAMESPACE -DQT_NO_DEPRECATED -DQT_NO_TRANSLATION -DQT_QMAKE_LOCATION=\"/builddir/build/BUILD/build_release_static_win32/bin/qmake\" -DQT_NO_CAST_FROM_ASCII -DQT_BUILD_BOOTSTRAP_LIB -DQT_BUILDING_QT -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_DEBUG -DQT_NO_EXCEPTIONS -I/builddir/build/BUILD/qtbase-opensource-src-5.0.0/mkspecs/linux-g++ -I/builddir/build/BUILD/qtbase-opensource-src-5.0.0/src/tools/bootstrap -I../../../include -I../../../include/QtCore -I../../../include/QtCore/5.0.0 -I../../../include/QtCore/5.0.0/QtCore -I../../../include/QtXml -I/builddir/build/BUILD/build_release_static_win32/include/QtXml/5.0.0 -I/builddir/build/BUILD/build_release_static_win32/include/QtXml/5.0.0/QtXml -I../../corelib/global -I/builddir/build/BUILD/qtbase-opensource-src-5.0.0/src/3rdparty/zlib -I. -o .obj/release-static/qstring.o /builddir/build/BUILD/qtbase-opensource-src-5.0.0/src/corelib/tools/qstring.cpp
      In file included from /builddir/build/BUILD/qtbase-opensource-src-5.0.0/src/corelib/tools/qstring.cpp:50:0:
      /builddir/build/BUILD/qtbase-opensource-src-5.0.0/src/corelib/tools/qsimd_p.h:146:23: fatal error: x86intrin.h: No such file or directory
      compilation terminated.
      make[3]: *** [.obj/release-static/qstring.o] Error 1
      make[3]: *** Waiting for unfinished jobs....
      make[3]: Leaving directory `/builddir/build/BUILD/build_release_static_win32/src/tools/bootstrap'
      make[2]: *** [sub-tools-bootstrap-make_first] Error 2
      

      I think I've found the root cause of this failure but I don't know what the most proper way to fix it is.

      At the moment the configure script generates a qconfig.h file which describes the features of the compiler of the target platform (in this case for the i686-w64-mingw32 target). In our situation this file contains defines like:

      #define QT_COMPILER_SUPPORTS_SSE2
      #define QT_COMPILER_SUPPORTS_SSE3
      #define QT_COMPILER_SUPPORTS_SSSE3
      #define QT_COMPILER_SUPPORTS_SSE4_1
      #define QT_COMPILER_SUPPORTS_SSE4_2
      #define QT_COMPILER_SUPPORTS_AVX
      #define QT_COMPILER_SUPPORTS_AVX2

      The build failure I mentioned earlier suspects that QT_COMPILER_SUPPORTS_AVX is defined while it shouldn't be. The qsimd_p.h file contains this piece of code:

      #if defined(QT_COMPILER_SUPPORTS_AVX) && defined(Q_CC_GNU)
      #define QT_COMPILER_SUPPORTS_X86INTRIN
      #include <x86intrin.h>
      #endif

      When cross-compiling Qt5 from a x86 (or x86_64) host these features are (by coincidence) also supported by the host compiler (gcc). However, when the host compiler is using a completely different architecture (like ppc and s390) these defines aren't valid.

      I suspect that the generated qconfig.h file is used to compile the native tools (qmake/moc/..) while it actually shouldn't rely on its contents.

      One possible solution to this would be to have the configure script generate another qconfig.h file which contains the host-specific compiler features (instead of the target-specific compiler features) and have this qconfig.h file used when compiling the native tools.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            epienbroek Erik van Pienbroek
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes