Qt5.7 on Pi
On PC
Create a directory where you will be working from
mkdir ~/raspberry
cd ~/raspberry
Save env variables to the setdevenv.sh file
#!/bin/sh
WORKINGDIRECTORY=$HOME/raspberry
TOOLCHAIN=gcc-4.7-linaro-rpi-gnueabihf
MOUNTPOINT=/mnt/raspberry-rootfs
export PATH=$PATH:$WORKINGDIRECTORY/$TOOLCHAIN/bin
Download and unzip gcc for raspberry pi
wget http://www.tequnique.com/dl/raspberry/gcc-4.7-linaro-rpi-gnueabihf.tbz
tar xfj gcc-4.7-linaro-rpi-gnueabihf.tbz
Install libraries so we could compile for 32bit arch.
sudo apt-get install ia32-libs
On Pi
Update and Upgrade Pi
ssh pi@"raspberry ip address"
sudo apt-get update
sudo apt-get upgrade
Enable some stuff for QT
sudo apt-get install libfontconfig1-dev libsqlite3-dev libxslt1-dev libssl-dev 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
sudo shutdown -h now
Back to PC
Make an image of your Pi Image
cd ~/raspberry
sudo dd if=/dev/sdb of=raspberry-working-image.img
Mounting get sometimes tricky...
sudo /sbin/losetup /dev/loop0 raspberry-working-image.img
$ sudo /sbin/fdisk -l /dev/loop0
Disk /dev/loop0: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x25b0a410
Device Boot Start End Sectors Size Id Type
/dev/loop0p1 8192 137215 129024 63M c W95 FAT32 (LBA)
/dev/loop0p2 137216 62333951 62196736 29.7G 83 Linux
sudo mount -o loop,offset=$((137216*512)) raspberry-working-image.img /mnt/raspberry-rootfs
Run the script to set new env variables
source setdevenv.sh
Download cross compile toolchain
git clone https://gitorious.org/cross-compile-tools/cross-compile-tools.git
cd cross-compile-tools
sudo ./fixQualifiedLibraryPaths $MOUNTPOINT ~/raspberry/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-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
Maybe Required
sudo ln -s /mnt/raspberry-rootfs/lib/arm-linux-gnueabihf /lib/
Configuring & Compiling
wget http://download.qt.io/official_releases/qt/5.7/5.7.0/single/qt-everywhere-opensource-src-5.7.0.tar.gz
tar xfvz qt-everywhere-opensource-src-5.7.0.tar.gz
cd qt-everywhere-opensource-src-5.7.0
./configure \
-release \
-opengl es2 \
-optimized-qmake \
-no-pch \
-make libs \
-make tools \
-reduce-exports \
-sysroot /mnt/raspberry-rootfs \
-device linux-rasp-pi-g++ \
-device-option CROSS_COMPILE=~/raspberry/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- \
-prefix /usr/local/Qt-5.7-raspberry \
-opensource \
-nomake examples \
-nomake tests \
-confirm-license \
-no-qml-debug
make -j4
sudo make -j4 install
sync
sudo umount /mnt/raspberry-rootfs
sudo dd bs=4M if=raspberry-working-image.img of=/dev/sdb
- Add Generic linux device
- Add compiler: GCC: /home/ham/raspberry/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g++
- Add debugger: /home/ham/raspberry/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gdb
- Add Qt version: /usr/local/Qt-5.7-raspberry/bin/qmake
- Add kit: sysroot: /mnt/raspberry-rootfs