Monday, September 9, 2019

Raspbian Buster and Cross Toolchain for Linux and Mac OS 8.3.0

Raspbian Buster is out. It seems it updated gcc from version 6.3.0 (used for Stretch) to gcc version 8.3.0. This is not always needed, but I had a lot of problems in the past related to using an outdated crosscompiler, or the one provided in the raspberry repo: I therefore built my own toolchain for Stretch, which I provided here, both for Linux and Mac OS.

I did the same for Buster: I built my own toolchain and I built many projects with it, like Qt, ffmpeg etc... Just place the toolchain in /opt/rpi (probably position independent) and you should be done. This toolchain should be 100% compatible with gcc provided by Buster.

Download cross toolchain GCC 6.3.0 for Stretch here.
Download Linux x64 cross toolchain GCC 8.3.0 here.
Download Mac OS cross toolchain GCC 8.3.0 here.

Bye ;-)


  1. hi
    welcome back
    do you will build new Qt version 12 or 13 for raspberry pi

  2. Thank you Luca.
    Just for the others, your toolchain is not position independent, so it have to be placed in /opt/rpi.

    Thanks again.

    1. Correct. I tried to create it position independent in the past but it seemed not to work properly on mac.

  3. Hello,

    the binaries generated when compiling works on raspberry pi 4 and raspberry pi 3?

    Good job Luca.

    1. You I built for, at least, armv7 and armv8 with this toolchain. So rpi2, rpi3 and rpi4. Didn't try armv6.

    2. I used this toolchain to crosscompile Qt5.12.5 for raspberry pi4 with these modules: qtdeclarative qtquickcontrols qtquickcontrols2 qtmultimedia qtsvg qtxmlpatterns qtgraphicaleffects qtwebsockets. It works like a charm!

    3. Hi, Mattia. Was you actually able to run pocplayer on RPi4?

  4. I use this toolchain t crosscompile Qt5.12.5 for raspberry pi4 on Ubuntu 18.04 and I have this error on compile time:

    /opt/rpi/rpi-gcc-8.3.0/bin/arm-linux-gnueabihf-g++ -c -include .pch/Qt5Core -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/opt/rpi/buster_enigma/sysroot/ -O3 -std=c++1z -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -D_REENTRANT -fPIC -DQT_NO_USING_NAMESPACE -DQT_NO_FOREACH -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_CORE_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -I. -Iglobal -I../3rdparty/harfbuzz/src -I../3rdparty/md5 -I../3rdparty/md4 -I../3rdparty/sha3 -I../3rdparty/forkfd -I../3rdparty/tinycbor/src -I../../include -I../../include/QtCore -I../../include/QtCore/5.12.5 -I../../include/QtCore/5.12.5/QtCore -I.moc -I.tracegen -isystem /opt/rpi/buster_enigma/sysroot/usr/include/glib-2.0 -I/opt/rpi/buster_enigma/sysroot/usr/lib/arm-linux-gnueabihf/glib-2.0/include -isystem /opt/rpi/buster_enigma/sysroot/usr/include -I/opt/rpi/buster_enigma/sysroot/opt/vc/include -I../../mkspecs/devices/linux-rasp-pi3-vc4-g++ -o .obj/qlockfile_unix.o io/qlockfile_unix.cpp
    io/qfilesystemengine_unix.cpp: En la función ‘int qt_statx(const char*, statx*)’:
    io/qfilesystemengine_unix.cpp:323:26: error: ‘AT_FDCWD’ no se declaró en este ámbito
    return qt_real_statx(AT_FDCWD, pathname, 0, statxBuffer);

    1. AT_FDCWD is defined in fcntl.h in the toolchain.

  5. Thank you for your toolchain! It helped me getting started, but unfortunately there were some issues especially with ARMv6 support.

    I created a new repository for a toolchain based on GCC8 and ARMv6 support. Feel free to link it:

  6. Thank you for this amazing work.
    I used this toolchain to cross compile POT, QT 5.12.5 and my QT application.
    It is a QT QML project that plays one video.

    It copied qt_driver to mediaservice and I think it is all in the rigth place.
    But my application could not run. It always stop in the problema above.
    I hope maybe someone could read this and give me some light.

    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/qt5pi/plugins/video/videonode" ...
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/video/videonode/"
    Found metadata in lib /usr/local/qt5pi/plugins/video/videonode/, metadata=
    "IID": "org.qt-project.qt.sgvideonodefactory/5.2",
    "MetaData": {
    "Keys": [
    "archreq": 0,
    "className": "QSGVideoNodeFactory_EGL",
    "debug": false,
    "version": 330752

    Got keys from plugin meta data ("egl")
    QFactoryLoader::QFactoryLoader() checking directory path "/home/pi/video/videonode" ...
    loaded library "/usr/local/qt5pi/plugins/video/videonode/"
    Requesting control for org.qt-project.qt.videorenderercontrol/5.0...
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/qt5pi/plugins/accessible" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/home/pi/accessible" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/qt5pi/plugins/accessiblebridge" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/home/pi/accessiblebridge" ...
    Bus error

    1. I forgot to mention that I got a message in dmesg: Unhandled prefetch abort: unknown 1 (0x001)

    2. Is a minimal Qt app working properly? Does the app work without multimedia?
      Maybe wrong arch? What is readelf -a saying about /usr/local/qt5pi/plugins/video/videonode/

    3. Thank you for the response.
      I can make a minimal app that works without multimedia.

      Tha readelf gives me:

      Attribute Section: aeabi
      File Attributes
      Tag_CPU_name: "8-A"
      Tag_CPU_arch: v8
      Tag_CPU_arch_profile: Application
      Tag_ARM_ISA_use: Yes
      Tag_THUMB_ISA_use: Thumb-2
      Tag_FP_arch: VFPv2

      when I check a random lib I got

      Attribute Section: aeabi
      File Attributes
      Tag_CPU_name: "6"
      Tag_CPU_arch: v6
      Tag_ARM_ISA_use: Yes
      Tag_THUMB_ISA_use: Thumb-1
      Tag_FP_arch: VFPv2

      Maybe I make a mistake and compile QT as armv8 instead of armv6? I tought it should be armv7. Anyway I will study more about it ..

    4. I am using buster built using pi-gen tool.

    5. Armv8 is ok then. You'll have to debug deeper. I'd try gdb or strace.

    6. I will try going deeper.
      Thank you.

    7. Hi @Gabriel
      Did you manage to solve your issue? I got the same issue like you.
      If you have any news, please share

  7. @Kien, Sorry for the late response.
    I could compile qt 5.12.5 with webengine support using the instructions here.
    But I modify it to use the toolchain provided by Luca.
    One thing that I did to work was change the links to absolute path in arm-linux-gnueaubihf in the rootfs.
    After that I could compile and run POT ok.

  8. My problem now is that WebEngineView component is using almost all cpu in my board. It works but uses 300% of cpu in top. If anyone has some tips I would appreciate

  9. Hi luca, great work. i'm using it and it works like a charm.
    See you

  10. Hi Luca, great work but I was wondering why you didn't include gdb in the toolchain (currently using on on Big Sur)

    1. Hello, I typically use gdb from the pi itself, so I was not interested.