Search code examples
qtcross-compilingraspberry-piraspbiancrosstool-ng

Error when cross compiling Qt 5.0.1 for the Raspberry Pi


I'm trying to cross compile Qt 5.0.1 (latest release at the moment) for my Raspberry Pi. My set up is as follows:

Operating System: Ubuntu 12.04 32-bit

Cross compiler: Built from crosstool-NG program, using the exact instructions found here

Raspberry Pi Operating System: Raspbian Wheezy 2013-02-09 (mounted at /mnt/raspberry-pi-rootfs)

Configure command:

./configure -no-pch -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=/home/<myusername>/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi- -sysroot /mnt/raspberry-pi-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5-raspberry-pi -v

When I run the configure command, it always fails with the following error:

Could not determine the target architecture!

/mnt/raspberry-pi-rootfs/usr/include/features.h:323:26: fatal error: bits/predefs.h: No such file or directory

Anyone know what this means?

I have tried the latest pre-built Linaro Toolchain cross compiler from here, and Qt at least builds, but any program compiled with it causes SIGILL (illegal instruction) fault as soon as the program runs up, which I guess is because the pre-built cross compler I used is not targeting the right architecture.

Note:

I am aware cross compiling is fiendishly difficult, but I'd like to understand more about what is going on


Solution

  • I'm not sure what the exact cause of this message was, but I managed to sort out by using a pre-buils toolchain for the Raspberry Pi from here:

    https://github.com/raspberrypi/tools