At least Debian does not provide a usable toolchain to cross develop for the Raspberry Pi 1. The Linaro toochain is at the time of this writing too old for the Qt5 developer branch. There is a project crosstools-ng, which allows to easily build custom toolchains for all kinds of systems. It supports a fairly modern GCC 4.9.1. The configuration is a bit trial and error, but the main problem is, that the toolchain does not find all the include files or libraries. How is the crosstools-ng to be configured so it can be used to compile Qt5 for the Raspberry Pi 1?
A followup how a Raspberry Pi with Raspian has to be prepared to use this toolchain can be found here: How do I prepare a Raspberry Pi with Raspbian so I can cross compile Qt5 programs from a Linux host?
I start with the not found include/library problem first, since this goes a bit beyond the normal crosstools-ng installation/usage.
The problem is, that crosstools-ng rightfully creates gcc compiler, with a target tuple like: arm-vendor-linux-gnueabihf. This is totally correct. However, Raspian installs includes and libs in folders without vendor string: /lib/arm-linux-gnueabihf. Looks like pkg-config cannot handle this. crosstools-ng might be right with the tuple, but is also a bit heavy handed by refusing to add a function to remove this vendor string. The functions in crosstool-ng, which allow to modify the tuple and the vendor string are not an alternative. They just create symbolic links with a new name, but the tuple is hardcoded in GCC. The only way to properly get rid of the vendor string is to patch the crosstools-ng sources.
So the first step to get a functional Raspberry Pi/Raspian gcc 4.9.1 toolchain is to clone the crosstools-ng repository:
Second is to patch sources:
The rest is the standard configure/make/make install. The next step is to configure crosstools-ng correctly to build the desired toolchain. This is done with
ct-ng menuconfig
.Going though every single config item would be extremely lengthy, so I added a working config file here: http://pastebin.com/MhQKnhpN
It can be imported and with Load an Alternate Configuration File. Finally
ct-ng build
builds in a few minutes a new toolchain. The toolchain is created in {HOME}/x-tools3, as defined in the config file. To change this, change 'Prefix directory' in 'Path and misc options'. But the toolchain can also be moved manually after the build.The next question/answer will show how to use this toolchain to build a very modern Qt5 for the Raspberry Pi.