交叉编译树莓派QT5.10
环境准备
- Raspberry PI3
- System image: 2017-11-29-raspbian-stretch.zip
- Qt Version: Qt5.10.0
- Host: Ubuntu 14.04
- Cross Compiler: gcc-linaro-4.9-2015.02-3-x86_64_arm-linux-gnueabihf
挂载镜像
挂载镜像更稳健系统到 /mnt
$ unzip 2017-11-29-raspbian-stretch.zip
Archive: 2017-11-29-raspbian-stretch.zip
inflating: 2017-11-29-raspbian-stretch.img
$ sudo fdisk -l 2017-11-29-raspbian-stretch.img
[sudo] password for wind:
Disk 2017-11-29-raspbian-stretch.img: 4919 MB, 4919918592 bytes
255 heads, 63 sectors/track, 598 cylinders, total 9609216 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
Disk identifier: 0x49783f5b
Device Boot Start End Blocks Id System
2017-11-29-raspbian-stretch.img1 8192 93236 42522+ c W95 FAT32 (LBA)
2017-11-29-raspbian-stretch.img2 94208 9609215 4757504 83 Linux
### offset = 94208 * 512 = 48234496
$ sudo mount -o loop,offset=48234496 2017-11-29-raspbian-stretch.img /mnt
$ cd /mnt
ROOTFS=/mnt
TOOLCHAIN=/path/to/gcc-linaro-4.9-2015.02-3-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
配置
$ tar -xJvf qt-everywhere-src-5.10.0.tar.xz
$ cd qt-everywhere-src-5.10.0
$ ./configure -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=/home/wind/opt/raspi/tools/arm-bcm2708/gcc-linaro-4.9-2015.02-3-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5
### add -make tools -make examples options if need
此时出下面的错误
ERROR: Cannot compile a minimal program. The toolchain or QMakeSpec is broken.
ERROR: The OpenGL functionality tests failed! You might need to modify the include and library search paths
by editing QMAKE_INCDIR_OPENGL[_ES2], QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for yo