Qt

Create a working directory on your Ubuntu PC:

mkdir ~/acme
cd ~/acme

Create a file called setdevenv.sh with this content:

#!/bin/sh
WORKINGDIRECTORY=$HOME/acme
TOOLCHAIN=gcc-arm-linux-gnueabi
MOUNTPOINT=/mnt/acme-rootfs
export PATH=$PATH:$WORKINGDIRECTORY/$TOOLCHAIN/bin

If you are using an Acqua or Roadrunner board change this line:

TOOLCHAIN=gcc-arm-linux-gnueabihf

For 64 bit Ubuntu PC:

sudo apt-get install ia32-libs

or

sudo apt-get install g++-multilib zlib1g:i386

On the Acme board type:

apt-get update
apt-get install libfontconfig1-dev libsqlite3-dev libxslt1-dev libssl-dev

For QMultimedia:

apt-get install libasound2-dev libavcodec-dev libavformat-dev libswscale-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev gstreamer-tools gstreamer0.10-plugins-good gstreamer0.10-plugins-bad

Shutdown the board

shutdown -h now

Remove microSD card from the board and insert into PC

Copy microSD card to a PC image

cd ~/acme
sudo dd if=/dev/sdb of=acme-working-image.img

Mount the image

sudo /sbin/losetup /dev/loop0 acme-working-image.img

Determine block size: 1818624*512 = 931135488. NOTE: "1818624" is the value you get from this command:

sudo /sbin/fdisk -l /dev/loop0
    
sudo mkdir /mnt/acme-rootfs
sudo mount -o loop,offset=931135488 acme-working-image.img /mnt/acme-rootfs

Cross compile tools

source setdevenv.sh

git clone https://gitorious.org/cross-compile-tools/cross-compile-tools.git
cd cross-compile-tools
    
sudo ./fixQualifiedLibraryPaths $MOUNTPOINT /usr/bin/arm-linux-gnueabi-gcc
    
sudo ln -s \
$MOUNTPOINT/opt/vc/include/interface/vmcs_host/linux/vchost_config.h \
$MOUNTPOINT/opt/vc/include/interface/vmcs_host/vchost_config.h
    
cd ..

Qt

Download Qt (you can also check the latest versione from here)

wget http://download.qt.io/official_releases/qt/5.8/5.8.0/single/qt-everywhere-opensource-src-5.8.0.tar.gz
tar xfvz qt-everywhere-opensource-src-5.8.0.tar.gz
cd qt-everywhere-opensource-src-5.8.0

./configure \
-release \
-opengl es2 \
-optimized-qmake \
-no-pch \
-make libs \
-make tools \
-reduce-exports \
-sysroot /mnt/acme-rootfs \
-device linux-arm-generic-g++ \
-device-option CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- \
-prefix /usr/local/Qt-5.8.0-acme \
-opensource -nomake examples -nomake tests \
-confirm-license

Use other values instead of "4" depending on the number of processor cores on your host machine

make -j4
sudo make -j4 install

cd ..
source setdevenv.sh
sudo cp -r /usr/local/Qt-5.4.1-raspberry/mkspecs $MOUNTPOINT/usr/local/Qt-5.4.1-raspberry

Unmount image

sync
sudo umount /mnt/raspberry-rootfs

Copy image back to SD card

sudo dd bs=4M if=raspberry-working-image.img of=/dev/sdb

The SD card can now be inserted back into the Raspberry Pi.

Setup Qt Creator. We assume that you have installed Qt Creator already.

1.) Add Generic linux device
2.) Add compiler: GCC: /home/ham/raspberry/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g++
2.1) Add debugger: /home/ham/raspberry/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gdb
3.) Add Qt version: /usr/local/Qt-5.4.1-raspberry/bin/qmake
4.) Add kit: sysroot: /mnt/raspberry-rootfs

Development with Qt Creator

Mount Raspberry image EVERY TIME BEFORE development:

cd ~/raspberry
sudo mount -o loop,offset=931135488 raspberry-working-image.img /mnt/raspberry-rootfs

Add the following lines to the project .pro file:

target.path = /home/pi
INSTALLS += target

Unmount image AFTER development

sync
sudo umount /mnt/raspberry-rootfs

Links