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

Cross-compile Qt6. features: sse2

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • 6.5.0, 6.6.0
    • 6.4.1
    • Build System: CMake
    • None
    • host: Ubuntu 22 5.15 x86_64
      target: Buildroot X86 no-sse2 (AMD Geode)
    • Linux/Yocto
    • 9615e7f9e (dev), b23437a21 (6.5)

    Description

      I want cross-compile Qt 6.4.1 for my X86 no-SSE2 CPU (AMD Geode). I use Ubuntu 22 x86_64 as host.
      1) I build my Linux distro using Buildroot . I configure it Buildroot config for AMD Geode.7z. Buildroot project also give me sysroot, gcc and g++ for cross-compile. I test it, I successfully cross-compile very simple test_SSE2-1.zip, it runs on AMD Geode into my own distro ok and printf 0.
      2) I build small (no graphics) qtbase for host:

       

      cd build_host &&
      ../qt5/configure -release -static -opensource -nomake examples -nomake tests -confirm-license -no-pch -no-xcb -no-xcb-xlib -no-gtk -skip webengine -skip qtwayland -skip qtdoc -skip qtgraphicaleffects -skip qtqa -skip qttranslations -skip qtvirtualkeyboard -skip qtquicktimeline -skip qtquick3d -skip qt3d -skip qtrepotools -skip qttools -skip qtimageformats -skip qtnetworkauth -skip qtwebsockets -skip qtactiveqt -skip qtmacextras -skip winextras -skip qtmultimedia -skip qtgamepad -skip qtserialbus -skip qtspeech -skip qtsensors -skip qtcharts -skip qtlocation -no-ssl -platform linux-g++-32 -prefix ../build_artifacts_host – -DCMAKE_TOOLCHAIN_FILE=/home/a/QtFromGit/toolchain_host.cmake &&
      cmake --build . --parallel && cmake --install .
      

       

      toolchain_host.zip
      3) I cross-compile small (no graphics) qtbase for AMD Geode:

       

      cd build_cross &&
      ../qt5/configure – -GNinja -DCMAKE_BUILD_TYPE=Release -DQT_BUILD_EXAMPLES=OFF -DQT_BUILD_TESTS=OFF -DCMAKE_STAGING_PREFIX=/home/a/QtFromGit/build_artifacts_cross -DCMAKE_TOOLCHAIN_FILE=/home/a/QtFromGit/toolchain_cross.cmake -S /home/a/QtFromGit/qt5 &&
      cmake --build . --parallel && cmake --install .
      

       

      toolchain_cross.zip
      4) I create empty Qt console cmake app (without my code) via Qt Creator.

      #include <QCoreApplication>
      int main(int argc, char *argv[]){
      QCoreApplication a(argc, argv); 
      return a.exec();
      }
      

       

      I build console app using ~/QtFromGit/build_artifacts_cross/bin/qt-cmake from stage 3) and copy-past executable file "test_SSE2" to AMD Geode. I use commands:

       

      ~/QtFromGit/build_artifacts_cross/bin/qt-cmake -S ~/QtFromGit/test_SSE2/ -B ~/QtFromGit/test_SSE2/build-test_SSE2/ -DCMAKE_BUILD_TYPE=Release &&
      cmake --build .
      

      On X86 CPU my console app says:
      "Incompatible processor. This Qt build requires the following features:
      sse2"

      I use CMake GUI to understand what steps do qt-cmake.

      Looks like qt-cmake doesn't knows about target system capabilities (no flags like -mno-sse2 -mno-sse3 and others). Looks like qt-cmake allow my cross-compile g++ to add some illegal SSE2 code. Am I right? How cross-compile app for X86 no-sse2 ?

       

      _______________________________________

      Also I try add options to toolchain_cross.cmake but no happy end.
      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${TARGET_SYSROOT}/usr/include -mno-sse2")
      set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -mno-sse2")
      set(QT_COMPILER_FLAGS "-march=i386 -mno-sse2") #no effect with/without: -mno-sse -mfpmath=387 -mno-sse3 -mno-sse4 -mno-sse4.1 -mno-sse4.2 -mno-sse4a -mno-ssse3 -mno-avx -mno-sse2

      Also my Configure summary for cross-compile Qt well-know that my machine is no-SSE2 feature. But still generate SSE2 code...

      Building for: linux-g++ (i386, CPU features: 3dnow 3dnow-a mmx)
      Compiler: gcc 11.3.0
      Build options:
      Mode ................................... release
      Optimize release build for size ........ no
      Fully optimize release builds (-O3) .... no
      Building shared libraries .............. no
      Using C standard ....................... <none>
      Using C++ standard ..................... C++17
      Using ccache ........................... no
      Using new DTAGS ........................ no
      Relocatable ............................ no
      Using precompiled headers .............. no
      Using LTCG ............................. no
      Using Intel CET ........................ no
      Target compiler supports:
      SSE .................................. <none>
      AVX .................................. <none>
      AVX512 ............................... <none>
      Other x86 ............................ <none>
      Sanitizers:
      Addresses ............................ no
      Threads .............................. no
      Memory ............................... no
      Fuzzer (instrumentation only) ........ no
      Undefined ............................ no
      Build parts ............................ libs
      Qt modules and options:
      Qt Concurrent .......................... no
      dbus ................................... no
      dbus_linked ............................ no
      gui .................................... no
      network ................................ no
      Qt PrintSupport ........................ no
      Qt Sql ................................. no
      Qt Testlib ............................. no
      widgets ................................ no
      Qt Xml ................................. no
      Support enabled for:
      Using pkg-config ....................... no
      udev ................................... no
      Using system zlib ...................... yes
      Zstandard support ...................... no
      Thread support ......................... yes
      Common build options:
      Linker can resolve circular dependencies yes
      Qt Core:
      backtrace .............................. no
      DoubleConversion ....................... yes
      Using system DoubleConversion ........ no
      GLib ................................... yes
      ICU .................................... no
      Using system libb2 ..................... no
      Built-in copy of the MIME database ..... no
      cpp/winrt base ......................... no
      Tracing backend ........................ <none>
      Logging backends:
      journald ............................. no
      syslog ............................... no
      slog2 ................................ no
      PCRE2 .................................. yes
      Using system PCRE2 ................... no
      CLONE_PIDFD support in forkfd .......... no
      Core tools:
      Android deployment tool ................ no
      macOS deployment tool .................. no
      Windows deployment tool ................ no
      qmake .................................. no

      Attachments

        1. 6.4.2.png
          6.4.2.png
          61 kB
        2. build.ninja
          565 kB
        3. Buildroot config for AMD Geode.7z
          19 kB
        4. CMakeError.log
          13 kB
        5. CMakeError-1.log
          16 kB
        6. cmake-gui out.png
          cmake-gui out.png
          131 kB
        7. CMakeOutput.log
          79 kB
        8. CMakeOutput-1.log
          77 kB
        9. test_SSE2-1.zip
          71 kB
        10. toolchain_cross_full.cmake
          7 kB
        11. toolchain_cross.zip
          2 kB
        12. toolchain_host.zip
          2 kB

        Issue Links

          Activity

            People

              qtbuildsystem Qt Build System Team
              dungeonlords Andrei Cherniaev
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: