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. Issues setting up GCC 8.3.0 Cross Compiler to compile Qt 5.15 for Raspberry Pi 4
QtWS25 Last Chance

Issues setting up GCC 8.3.0 Cross Compiler to compile Qt 5.15 for Raspberry Pi 4

Scheduled Pinned Locked Moved Solved Installation and Deployment
raspberry pi 4cross-compiletoolchainembeddedqt 5.15
3 Posts 2 Posters 3.1k Views
  • 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.
  • C Offline
    C Offline
    cosmonaut65
    wrote on 9 Jul 2020, 09:39 last edited by
    #1

    Hi!

    I'm trying to cross-compile Qt 5.15.0 for a Raspberry Pi 4 and I'm having trouble with the toolchain.
    I'm very new to cross-compiling (and compilation on Linux in general), so any advice would be appreciated.

    My Setup:
    Raspberry Pi 4: Pi OS (32-bit) May 2020 Version (Kernel 4.19)

    Host: Ubuntu 20.04 LTS Running in VMWare Player

    I've been mainly following these two guides:

    1. https://wapel.de/?p=641 (mainly following this - make failed due to an error related to C++11 not being enabled)
    2. https://www.interelectronix.com/de/qt-auf-dem-raspberry-pi-4.html (followed this to change the gcc compiler 8.3.0 to try fix above issue)

    These are the key steps:

    1. Synced the folder structure using rsync
    2. Adjusted symlinks to be relative
    3. Downloaded the Qt 5.15 source files
    4. Downloaded the toolchain
      i. Initially downloaded from: https://github.com/raspberrypi/tools (GCC version was 4.7 or 4.8 I think)
      ii. After issues, downloaded the GCC Cross Compiler Toolchain(Buster) 8.3.0 from here: https://github.com/abhiTronix/raspberry-pi-cross-compilers#d-toolchain-binaries-downloads

    I extracted the toolchain inside the tools folder (folder structure shown below).

    I used these commands to modify the source files to allow me to use the new toolchain:

    cp -R qt-everywhere-src-5.15.0/qtbase/mkspecs/linux-arm-gnueabi-g++ qt-everywhere-src-5.15.0/qtbase/mkspecs/linux-arm-gnueabihf-g++
    
    sed -i -e 's/arm-linux-gnueabi-/arm-linux-gnueabihf-/g' qt-everywhere-src-5.15.0/qtbase/mkspecs/linux-arm-gnueabihf-g++/qmake.conf
    

    I created a build directory outside the source folder.

    This is what the folder structure roughly looked like on my Ubuntu VM:

    raspi
    ├── build
    ├── qt-everywhere-src-5.15.0
    │   ├── [Qt source files]
    ├── sysroot
    │   ├── lib
    │   ├── opt
    │   └── usr
    └── tools
       └── cross-pi-gcc-8.3.0-2
       │   ├── arm-linux-gnueabihf
       │   ├── bin
       │   ├── include
       │   ├── lib
       │   ├── libexec
       │   └── share

    Now my issue is with the configure step. I run the following command from within the build folder to configure my build:

    ../qt-everywhere-src-5.15.0/configure -release -opengl es2 -device linux-rasp-pi4-v3d-g++ -device-option CROSS_COMPILE=~/raspi/tools/cross-pi-gcc-8.3.0-2/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -no-use-gold-linker -v
    

    However, this fails. This is what the last few lines of my config.log file looks like:

    > /home/user_name/raspi/tools/cross-pi-gcc-8.3.0-2/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/user_name/raspi/sysroot -Wl,-O1 -Wl,-rpath-link,/home/user_name/raspi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/home/user_name/raspi/sysroot/lib/arm-linux-gnueabihf -o verifyspec verifyspec.o      
    > /home/user_name/raspi/tools/cross-pi-gcc-8.3.0-2/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: cannot find crt1.o: No such file or directory
    > /home/user_name/raspi/tools/cross-pi-gcc-8.3.0-2/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: cannot find crti.o: No such file or directory
    > /home/user_name/raspi/tools/cross-pi-gcc-8.3.0-2/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lm
    > collect2: error: ld returned 1 exit status
    > make: *** [Makefile:68: verifyspec] Error 1
    

    From what I can understand, it's having issues using the gcc toolchain that I downloaded. When I tried using the tool chain I mentioned in step 4i above, configure worked perfectly, I just had issues with the build. I'm guessing I've missed a key step in configuring the GCC 8.3.0 cross-compiler for this project.

    Could anyone point me in the right direction to fix this?

    Thanks!

    1 Reply Last reply
    0
    • C Offline
      C Offline
      cosmonaut65
      wrote on 12 Jul 2020, 20:00 last edited by
      #2

      I managed to solve this issue by following this guide:
      https://github.com/UvinduW/Cross-Compiling-Qt-for-Raspberry-Pi-4

      I think the cross-compiler I downloaded above had issues using my sysroot directory.
      The instructions linked above use a linaro compiler (albeit an older one) and it compiled Qt 5.15 successfully.

      1 Reply Last reply
      2
      • A Offline
        A Offline
        AbhiTronix
        wrote on 12 May 2021, 11:12 last edited by
        #3

        Hi author here,

        Now there's a dedicated guide available to follow for cross-compiling latest QT for any Raspberry Pi Model or Version with mentioned GCC toolchains:

        https://github.com/abhiTronix/raspberry-pi-cross-compilers/blob/master/QT_build_instructions.md

        1 Reply Last reply
        1

        • Login

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