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: https://github.com/raspberrypi/tools. 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 😉
Hi,
Have you tried to build your custom toolchain for the new RaspiOS based on Debian 11 bullseye OS ?
Your blog is always so interesting :-), thanks for sharing with us all this informations !
Best regards
Hello,
yes, I already started. I will publish the result as soon as I’m done.
Regards.
Thanks for your answer.
Looking for forward to read your next article on this topic 😉
Thomas
Hello, I published the new toolchain. It is working fine for me so far.
Regards.
Hello,
Great, I will try it today to build qt 5.15.7 ! I’ll let you know the result.
Regards
Thomas
Very well!
Finally done, the simple-video works 🙂
I had to copy files from the following folder:
– 3rdparty/ffmpeg/ffmpeg_pi2/lib/
– piomxtextures_qt_driver/mediaplayer/
You can use any pastebin servive: https://pb.luc4.duckdns.org
Mmh… not so much now… 🙂
However, simply look for the library. I don't remember where, but I'd go under piomxtextures_qt_driver, as it is a Qt driver.
ok, are you sure?
Your manual tells different: "If you're interested in the Qt plugin, once built, you should have the new openmaxil plugin in your Qt install dir".
Which files should i copy on the RPI to my /usr/local/qt5pi folder?
There are several pot folders that contain *.so files, e.g.
pot-5.7.3/3rdparty/ffmpeg/ffmpeg_pi2/lib/
pot-5.7.3/piomxtextures_lib
pot-5.7.3/piomxtextures_qt_driver/mediaplayer/
pot-5.7.3/piomxtextures_src/omxplayer_lib/
I do not think there is any install target. Once make is done, the library is ready. Put it manually in your Qt installation.
I cannot post the log of make-install. It seems like the blog-software doesn't allow it.
1) OK, thanks
2) OK, i repeated all steps and POT now seems to compile.
But make-install installs nothing. Would you have a hint?
Details:
– qmake writes only one line:
Info: creating stash file /home/niki/piview-dev/opt_qt_for_rpi/qt5.15.2/qtsrc/pot-5.7.3/.qmake.stash
– make seems to run without errors, only some warnings about code
– make-install writes "nothing to be done for 'install'" for each folder, e.g.:
1) They are only needed if you use protocols needing smb or ssl. Should not be needed for local files. I'm sorry, I don't remember the names of all the deps, probably also libssl-dev, libcrypto etc… but not sure, you should probably refer to ffmpeg docs.
2) Are you sure prepare_openmaxil_backend.sh is even needed? According to https://thebugfreeblog.blogspot.com/p/build-procedure-for-piomxtextures.html it seems that is part of the old build procedure. ./prepare_3rdparty.sh seems to be the only one needed before building the plugin itself.
You are using both versions in the script (RPI_COMPILER_PATH and COMPILER_PATH). It works now.
I am stuck with two problems:
1)
Are the ffmpeg options libsmbclient and libssl really needed? There seem to be missing files on my computer, but i cannot find out libraries to install. Any hints except libsmbclient-dev?
2)
I think you changed the folder structure, so that i need to patch your "prepare_openmaxil_backend.sh" (lines 64/65). But how?
cp -a build-PiOmxTextures/libPiOmxTextures* PiOmxTextures/lib
=> change like this?
cp -a build-PiOmxTextures/piomxtextures_lib/libPiOmxTextures* PiOmxTextures/lib
cp -a build-PiOmxTextures/piomxtextures/* PiOmxTextures/include
=> change to what?
Thanks for your help. I really hope i get it to work. Your pot still seems to be the only option for HW accelerated videos with QT/QML.
Nik
This is pretty old stuff. I guess the var was renamed to RPI_COMPILER_PATH: https://github.com/carlonluca/pot/blob/master/piomxtextures_tools/compile_ffmpeg.sh#L32.
Dear Luca,
i managed to crosscompile QT5.15.2 for a raspberry pi2.
Now, I am stuck at creating the pot-tools (v5.7.3).
I am using your toolchain from here: https://bugfreeblog.page.link/rasplinuxgcc830
I run "./prepare_3rdparty.sh pi2" which calls ./configure for ffmpeg.
This fails with:
arm-linux-gnueabihf-gcc is unable to create an executable file.
C compiler test failed.
Some lines from the ffmpeg config.log are:
..
COMPILER_PATH='/opt/rpi/rpi-gcc-8.3.0/bin'
..
WARNING: Unknown C compiler arm-linux-gnueabihf-gcc, unable to select optimal CFLAGS
..
arm-linux-gnueabihf-gcc -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -funsafe-math-optimizations -lm -mno-apcs-stack-check -mstructure-size-boundary=32 -mno-sched-prolog -E -o /tmp/ffconf.cc8oXqK7/test.o /tmp/ffconf.cc8oXqK7/test.c
./configure: 906: ./configure: arm-linux-gnueabihf-gcc: not found
..
C compiler test failed.
If i run /opt/rpi/rpi-gcc-8.3.0/bin/arm-linux-gnueabihf-gcc then i get "arm-linux-gnueabihf-gcc: fatal error: no input files". So i assume, it is finding the compiler at least.
I'd appreciate your help.
Nik
Works now, i moved it to the wrong folder.
The folder needs to be: /opt/rpi/rpi-gcc-8.3.0/
Hello, I see no error reported. If you run the compiler directly, does it work?
Dear Luca,
i am trying to use your toolchain (Linux x64) to crosscompile QT5.15.2 for the raspberry 2, Buster.
Would you please give some advice.
Previously i used the toolchain from: https://github.com/raspberrypi/tools
Now, i only changed the compiler line in my ./configure.sh to point to your toolchain in /opt/rpi/
Project ERROR: Cannot run target compiler '/opt/rpi/bin/arm-linux-gnueabihf-gcc-8.3.0g++'. Output:
===================
===================
Maybe you forgot to setup the environment?
Hello, I typically use gdb from the pi itself, so I was not interested.
Hi Luca, great work but I was wondering why you didn't include gdb in the toolchain (currently using on on Big Sur)
Hi luca, great work. i'm using it and it works like a charm.
See you
Hi, Mattia. Was you actually able to run pocplayer on RPi4?
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
@Kien, Sorry for the late response.
I could compile qt 5.12.5 with webengine support using the instructions here.
https://wiki.qt.io/RaspberryPiWithWebEngine
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.
Hi @Gabriel
Did you manage to solve your issue? I got the same issue like you.
If you have any news, please share
Thanks
Kien
I will try going deeper.
Thank you.
Armv8 is ok then. You'll have to debug deeper. I'd try gdb or strace.
pi 3b+
What pi are you on?
I am using buster built using pi-gen tool.
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 ..
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/libeglvideonode.so?
I forgot to mention that I got a message in dmesg: Unhandled prefetch abort: unknown 1 (0x001)
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/libeglvideonode.so"
Found metadata in lib /usr/local/qt5pi/plugins/video/videonode/libeglvideonode.so, metadata=
{
"IID": "org.qt-project.qt.sgvideonodefactory/5.2",
"MetaData": {
"Keys": [
"egl"
]
},
"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/libeglvideonode.so"
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
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:
https://github.com/Pro/raspi-toolchain
AT_FDCWD is defined in fcntl.h in the toolchain.
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);
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!
Correct. I tried to create it position independent in the past but it seemed not to work properly on mac.
You I built for, at least, armv7 and armv8 with this toolchain. So rpi2, rpi3 and rpi4. Didn't try armv6.
Hello,
the binaries generated when compiling works on raspberry pi 4 and raspberry pi 3?
Thanks.
Good job Luca.
Thank you Luca.
Just for the others, your toolchain is not position independent, so it have to be placed in /opt/rpi.
Thanks again.
Hello, sorry, not planning it for the moment.
hi
welcome back
do you will build new Qt version 12 or 13 for raspberry pi