Step-By-Step tutorial on how to cross-compile a Qt application for a raspberry pi zero w from any Linux Distribution in 2020 with Raspberry OS
-
I was using 17 tutorials on the subject and got nothing. I found the discussion to this official qt tutorial:
This entire process is utterly broken.. Bad links, code that wont compile, scripts that don't work.. did you even try any of it?????
Ive added changes to the wiki that have not been moderated yet..
If you provide a "how to" consider the following...- keep it updated or 2) step aside and let someone else do it..
Its the official QT wiki at least this one should be right...
... and ...
It looks like this page hasn't been properly updated in about two
years. Dead links all round etc. I'm currently trying to set up a
cross compiler so that I can compile an application on my PC and then
ssh it over to the Raspberry Pi. I'll try and get it working following
these steps and try editing the article where things don't seem to be
working. Jonnax (talk) 15:02, 12 June 2015 (UTC)...and to top all of this:
Since the script here uses dead links that redirect to phishing sites.
Perhaps someone could fix and change the script? Jonnax (talk) 17:32,
12 June 2015 (UTC)Could it be that hard to compile a piece of code for a cheap ARM? Aren't people paying fees starting at 500USD a month for the Qt toolkit to get something like that?
I got it working to cross-compile for android OS, windows OS, mac OS and different flavors of linux OS (Even arch linux from scratch) but I really stuck and hit the wall (17 times:) at this little piece of hardware.
So my question is: Would anyone kindly please write a working tutorial here that covers the topic? (The
stack-exchange for raspberry pi qt Tag
is full of questions about this topic but no answers yet.)When I got it working somehow I will write it myself and in addition host the virtual box images for free on my server to spare the struggle and keep the source updated.
Most tutorials are working with some broken links for older
ubuntu OS
versions and broken links to olderraspian OS
versions so I guess it would be most beneficial if the tutorial is created for the following (But It's totally up to you if even one would work):Ubuntu 20.04 LTS
https://ubuntu.com/download/desktopRaspberry Pi OS
(previously called Raspbian)
https://www.raspberrypi.org/downloads/Qt Qt Creator 4.12.2
https://www.qt.io/download-open-sourceVirtual Box 6.1
https://www.virtualbox.org/wiki/DownloadsPlease help - thanks upfront!
EDIT: I will try out some Docker Blog/Tutorial I just found and tell you if it did it.
What tutorials didn't work (or don't work anymore) and things I tried (To safe you about 3 Weeks of work):
-
https://wiki.archlinux.org/index.php/Cross-compiling_tools_package_guidelines
-
https://mechatronicsblog.com/cross-compile-and-deploy-qt-5-12-for-raspberry-pi/
-
https://github.com/ElektorLabs/160520-QT-compile-and-install-manual
-
https://www.interelectronix.com/de/qt-auf-dem-raspberry-pi-4.html
-
https://www.ics.com/blog/configuring-qt-creator-raspberry-pi
-
http://thebugfreeblog.blogspot.com/2012/11/bring-up-qt-50-on-raspberry-pi.html
-
https://forum.qt.io/topic/100994/qt5-12-x-raspberry-pi-zero-cross-compilation-qcoreapplication-error
-
https://github.com/chschnell/build-qt5-rpi/blob/master/build-qt5-rpi.sh
- keep it updated or 2) step aside and let someone else do it..
-
@JackTr said in Step-By-Step tutorial on how to cross-compile a Qt application for a raspberry pi zero w from any Linux Distribution in 2020 with Raspberry OS:
Aren't people paying fees starting at 500USD a month for the Qt toolkit to get something like that?
People paying for Qt can get direct support from QtCompany.
I agree a good and up-to-date description how to build Qt for RPi would be good, but somebody needs to write it. -
I had the same frustration until I found this complete and comprehensive guide:
https://github.com/UvinduW/Cross-Compiling-Qt-for-Raspberry-Pi-4
Kudos to Uvindu Wijesinghe for being awesome.
Verified it with Qt 5.15.0, Ubuntu 20.04 development machine and Raspberry Pi 3+ target. (Yes, this guide works for 3+ even though it says for 4). Also I've verified that this tutorial is still valid for Linaro toolchain 7.5.0.
Hope this helps.
Edit note: Additionally this guide does not use rpi-update which could be an issue on some setups (like mine).
-
@JackTr Hi, I just made a new guide on Qt Wiki on how to cross-compile a Qt 6 application to Raspberry Pi from an Ubuntu/Debian-based Linux distro to Raspberry Pi OS. However, it was tested with Raspberry Pi 4 Model B and not Raspberry Pi Zero W, but I would love to hear any feedback and see if it works with other Raspberry Pi boards :)
https://wiki.qt.io/Cross-Compile_Qt_6_for_Raspberry_Pi
Hope it helps.
-
I am trying to cross compile for a Raspberry Pi 4B and running into errors when building for the target device.
Is anyone available to help work through this? Right now I'm developing on Ubuntu and moving all of my source files to the Pi to build in place. This project will eventually have multiple devices that need to be updated. I won't be able to build from source for all them when I make functionality updates.