Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Cross compile build fails with qgrayraster.c
Forum Updated to NodeBB v4.3 + New Features

Cross compile build fails with qgrayraster.c

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
3 Posts 2 Posters 177 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    qtSucks
    wrote on 29 Mar 2025, 07:25 last edited by
    #1

    Reposting here as I realised this morning this is a better sub forum.
    Hi, I am cross compiling qt 6.4.2 using https://wiki.qt.io/Cross-Compile_Qt_6_for_Raspberry_Pi as my rough guide.
    I am using a tool chain from https://toolchains.bootlin.com/releases_aarch64.html

    After a lot of fiddling I ended up getting a successful* config with the following config command:

    ../qtbase/configure -release -opengl es2 -nomake examples -nomake tests -qt-host-path $CROSSCOMPILE/qt6/qt-host2 -extprefix $CROSSCOMPILE/qt6/qt-raspi2 -prefix /usr/local/qt6 -device linux-rasp-pi4-aarch64 -device-option CROSS_COMPILE=aarch64-linux-gnu- -submodules qtwayland -- -DCMAKE_TOOLCHAIN_FILE=$CROSSCOMPILE/toolchain.cmake -DQT_FEATURE_kms=ON -DQT_FEATURE_opengles2=ON -DQT_FEATURE_opengles3=ON

    *I say successful as there are no errors show to std out but CMakeConfigureLog.yaml contains several FAILED tests involving things like unrecognised command line option to disabled see QTBU123 etc

    but upon trying to build I get some errors, the first of which is:
    Building C object src/gui/CMakeFiles/Gui.dir/painting/qgrayraster.c.o FAILED: src/gui/CMakeFiles/Gui.dir/painting/qgrayraster.c.o /home/tommy/projects/rPi4_OS/crossCompile/toolchain/aarch64--glibc--stable-2021.11-1/bin/aarch64-linux-gcc --sysroot=/home/tommy/projects/rPi4_OS/crossCompile/toolchain/aarch64--glibc--stable-2021.11-1/aarch64-buildroot-linux-gnu/sysroot -DGui_EXPORTS -DMD4C_USE_UTF8 -DQT_ASCII_CAST_WARNINGS -DQT_BUILDING_QT -DQT_BUILD_GUI_LIB -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_DEPRECATED_WARNINGS -DQT_DEPRECATED_WARNINGS_SINCE=0x070000 -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_EGL_NO_X11 -DQT_LEAN_HEADERS=1 -DQT_MOC_COMPAT -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_EXCEPTIONS -DQT_NO_FOREACH -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_USING_NAMESPACE -DQT_QPA_DEFAULT_PLATFORM_NAME="xcb" -DQT_USE_QSTRINGBUILDER -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtpi-build2/src/gui/Gui_autogen/include -I/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtpi-build2/include -I/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtpi-build2/include/QtGui -I/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtbase/src/gui -I/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtpi-build2/src/gui -I/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtbase/src/gui/../3rdparty/VulkanMemoryAllocator -I/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtpi-build2/include/QtGui/6.4.2 -I/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtpi-build2/include/QtGui/6.4.2/QtGui -I/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtbase/src/gui/../3rdparty/md4c -I/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtbase/src/gui/../3rdparty/zlib/src -I/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtpi-build2/include/QtCore -I/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtbase/mkspecs/devices/linux-rasp-pi4-aarch64 -I/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtpi-build2/src/corelib -I/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtpi-build2/include/QtCore/6.4.2 -I/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtpi-build2/include/QtCore/6.4.2/QtCore -I/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtbase/src/3rdparty/libpng -I/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtbase/src/3rdparty/harfbuzz-ng/include/harfbuzz -I/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtbase/src/3rdparty/freetype/include -I/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtpi-build2/include/QtDBus -isystem /home/tommy/projects/rPi4_OS/crossCompile/rpi-sysroot/usr/include -I/home/tommy/projects/rPi4_OS/crossCompile/toolchain/aarch64--glibc--stable-2021.11-1/aarch64-buildroot-linux-gnu/sysroot/usr/include -pipe -DNDEBUG -O3 -std=c11 -fPIC -fvisibility=hidden -Wall -Wextra -fno-exceptions -MD -MT src/gui/CMakeFiles/Gui.dir/painting/qgrayraster.c.o -MF src/gui/CMakeFiles/Gui.dir/painting/qgrayraster.c.o.d -o src/gui/CMakeFiles/Gui.dir/painting/qgrayraster.c.o -c /home/tommy/projects/rPi4_OS/crossCompile/qt6/qtbase/src/gui/painting/qgrayraster.c In file included from /home/tommy/projects/rPi4_OS/crossCompile/qt6/qtbase/src/gui/painting/qgrayraster.c:152: /home/tommy/projects/rPi4_OS/crossCompile/rpi-sysroot/usr/include/stdlib.h:606:35: error: expected ‘,’ or ‘;’ before ‘attribute_alloc_align’ 606 | __THROW attribute_malloc attribute_alloc_align ((1)) | ^~~~~~~~~~~~~~~~~~~~~~~~~

    which being as its complaining about stdlib.h make me think there is a setting I must have fundamentally wrong but not sure where to start looking tbh. Any idea welcome. Thanks!

    1 Reply Last reply
    0
    • K Offline
      K Offline
      KH-219Design
      wrote on 29 Mar 2025, 17:43 last edited by
      #2

      Googling just the last parts of your error, this seems related: https://stackoverflow.com/questions/73303414/couldnt-build-llvm-with-gcc-on-archlinux

      And while there is no accepted answer, both of the proposed answers seem to indicate that include path(s) are what went wrong. The proposed answers suggest that extra paths ended up visible to the compiler, and therefore some unwanted headers were selected instead of the wanted ones.

      Seems reasonable to investigate that.

      There are many include paths listed in what you already shared, and (given only the briefest skim, not a thorough examination on my part) nothing looks "obviously" wrong. However, I do believe that compilers have "implicit" paths that they search in addition to explicitly-listed ones. There may also be some environment variable set that further interferes.

      What I often do in these situations is turn on whatever cmake/qmake/compiler verbosity options are needed in order to see the full, precise compiler command, and then I run just that single command myself (in the appropriate working directory and matching any other necessary environment).

      Once you are able to (in a terminal) just run the single command and replicate the error, then you can ADD and/or REMOVE flags that are passed to gcc.

      It seems you may have the complete command already. It seems to begin with:

      /home/tommy/projects/rPi4_OS/crossCompile/toolchain/aarch64--glibc--stable-2021.11-1/bin/aarch64-linux-gcc 
      

      You can try to run that command yourself in isolation (in the appropriate directory), and if you replicate the error, you can work forward from there.

      You can add extra flags to aarch64-linux-gcc to gain more fine-grained insight into what it does.

      For example, with most gcc, you have the option:

      -E                       Preprocess only; do not compile, assemble or link.
      

      Which allows you (with much patience) to inspect what happens to qgrayraster.c after ONLY preprocessor directives are expanded, and before compilation begins.

      www.219design.com
      Software | Electrical | Mechanical | Product Design

      1 Reply Last reply
      1
      • A aha_1980 referenced this topic on 29 Mar 2025, 17:53
      • Q Offline
        Q Offline
        qtSucks
        wrote on 31 Mar 2025, 07:49 last edited by
        #3

        That's some good tips with the -E option thanks I had never considered using that. Yep my suspicious was an include directory but just wasn't sure on the approach you have given me some ideas thanks.

        What do you think about the no errors on configure but lots FAILED in a the CMakeConfigureLog.yaml? To me it seems off to give no error but then the log file shows errors. I am not lookign for a solution to why they faild but more why have errors but have a successful config.
        They seem to be tests which I suppose can be non required especially on a development branch.
        E.g.

        `
        kind: "try_compile-v1"
        backtrace:
        - "/usr/share/cmake-3.28/Modules/Internal/CheckSourceCompiles.cmake:101 (try_compile)"
        - "/usr/share/cmake-3.28/Modules/CheckCXXSourceCompiles.cmake:52 (cmake_check_source_compiles)"
        - "cmake/QtFeature.cmake:968 (check_cxx_source_compiles)"
        - "configure.cmake:207 (qt_config_compile_test)"
        - "cmake/QtBaseGlobalTargets.cmake:83 (include)"
        - "CMakeLists.txt:125 (include)"
        directories:
        source: "/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtpi-build2/CMakeFiles/CMakeScratch/TryCompile-zWMx1V"
        binary: "/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtpi-build2/CMakeFiles/CMakeScratch/TryCompile-zWMx1V"
        cmakeVariables:
        CMAKE_CXX_FLAGS: " -I/home/tommy/projects/rPi4_OS/crossCompile/toolchain/aarch64--glibc--stable-2021.11-1/aarch64-buildroot-linux-gnu/sysroot/usr/include"
        CMAKE_CXX_FLAGS_DEBUG: "-g"
        CMAKE_EXE_LINKER_FLAGS: "-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed"
        CMAKE_MODULE_PATH: "/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtbase/cmake;/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtbase/cmake/3rdparty/extra-cmake-modules/find-modules;/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtbase/cmake/3rdparty/kwin;/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtbase/cmake/platforms"
        CMAKE_POSITION_INDEPENDENT_CODE: "ON"
        CMAKE_SYSROOT: "/home/tommy/projects/rPi4_OS/crossCompile/toolchain/aarch64--glibc--stable-2021.11-1/aarch64-buildroot-linux-gnu/sysroot"
        buildResult:
        variable: "HAVE_reduce_relocations"
        cached: true
        stdout: |
        Change Dir: '/home/tommy/projects/rPi4_OS/crossCompile/qt6/qtpi-build2/CMakeFiles/CMakeScratch/TryCompile-zWMx1V'

            Run Build Command(s): /usr/bin/ninja -v cmTC_84697
            [1/2] /home/tommy/projects/rPi4_OS/crossCompile/toolchain/aarch64--glibc--stable-2021.11-1/bin/aarch64-linux-g++ --sysroot=/home/tommy/projects/rPi4_OS/crossCompile/toolchain/aarch64--glibc--stable-2021.11-1/aarch64-buildroot-linux-gnu/sysroot -DHAVE_reduce_relocations  -I/home/tommy/projects/rPi4_OS/crossCompile/toolchain/aarch64--glibc--stable-2021.11-1/aarch64-buildroot-linux-gnu/sysroot/usr/include  -std=gnu++17 -fPIE -o CMakeFiles/cmTC_84697.dir/src.cxx.o -c /home/tommy/projects/rPi4_OS/crossCompile/qt6/qtpi-build2/CMakeFiles/CMakeScratch/TryCompile-zWMx1V/src.cxx
            FAILED: CMakeFiles/cmTC_84697.dir/src.cxx.o 
            /home/tommy/projects/rPi4_OS/crossCompile/toolchain/aarch64--glibc--stable-2021.11-1/bin/aarch64-linux-g++ --sysroot=/home/tommy/projects/rPi4_OS/crossCompile/toolchain/aarch64--glibc--stable-2021.11-1/aarch64-buildroot-linux-gnu/sysroot -DHAVE_reduce_relocations  -I/home/tommy/projects/rPi4_OS/crossCompile/toolchain/aarch64--glibc--stable-2021.11-1/aarch64-buildroot-linux-gnu/sysroot/usr/include  -std=gnu++17 -fPIE -o CMakeFiles/cmTC_84697.dir/src.cxx.o -c /home/tommy/projects/rPi4_OS/crossCompile/qt6/qtpi-build2/CMakeFiles/CMakeScratch/TryCompile-zWMx1V/src.cxx
            /home/tommy/projects/rPi4_OS/crossCompile/qt6/qtpi-build2/CMakeFiles/CMakeScratch/TryCompile-zWMx1V/src.cxx:2:4: error: #error Symbolic function binding on this architecture may be broken, disabling it (see QTBUG-36129).
                2 | #  error Symbolic function binding on this architecture may be broken, disabling it (see QTBUG-36129).
                  |    ^~~~~
            ninja: build stopped: subcommand failed.
            
          exitCode: 1
        

        `

        1 Reply Last reply
        0

        1/3

        29 Mar 2025, 07:25

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved