この時32bitのUbuntuを使うと面倒でない。
(64bitでもできる)
Raspberry Pi Beginners Guide - Qt Wiki
Raspbianのイメージをマウントするところまでは大体同じ
➜ opt pwd /home/{USER}/opt ➜ opt wget https://www.dropbox.com/s/sl919ly0q79m1e6/gcc-4.7-linaro-rpi-gnueabihf.tbz (or at http://de.sourceforge.jp/projects/sfnet_rfidmonitor/downloads/crosscompilation-resources/gcc-4.7-linaro-rpi-gnueabihf.tbz) ➜ opt tar -xf gcc-4.7-linaro-rpi-gnueabihf.tbz (省略) ➜ opt git clone https://git.milosolutions.com/other/cross-compile-tools.git (省略) ➜ opt git clone https://github.com/qt/qt5 -b 5.7 (省略) ➜ opt ls cross-compile-tools gcc-4.7-linaro-rpi-gnueabihf.tbz gcc-4.7-linaro-rpi-gnueabihf qt5 ➜ opt
という配置にしてに
➜ opt cd qt5 ➜ qt5 git:(5.7) ✗ ./init-repository (省略) ➜ qt5 git:(5.7) ✗ cd .. ➜ opt cd cross-compile-tools ➜ cross-compile-tools git:(master) ✗ sudo ./fixQualifiedLibraryPaths /mnt/rasp-pi-rootfs/ ~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc
つぎのqtbaseのconfigureで必要なプラグインのためにオプションを追加(-qt-xcb)したい
➜ opt cd qt5 ➜ qtbase git:(5.7) ./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=/home/$USER/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/rasp-pi-rootfs -opensource -confirm-license -optimized-qmake -release -make libs -prefix /usr/local/qt5pi
-qt-xcbでxcbプラグインが有効になる。
前にやったときはxcbのプラグインは有効になり、Makefileとかqmakeが生成されたが
二回目に試してみたところDependenciesなものが足りないと言われ仕方なく-qt-xcb無しで行った。
configureのまとめのような物が出たらOK
➜ opt cd qt5 ➜ qtbase git:(5.7) .make -j 4 && sudo make install
などとすると /usr/local/qt5pi/bin/ にRaspi用のqmakeなどができる。
qtimageformats, qtsvg, qtjsbackend, qtscript, qtxmlpatterns, qtdeclarative, qtsensors, qt3d, qtgraphicaleffects, qtjsondb, qtlocation, qtdocgallery qtserialport, qtserialbus
あたりの順番でqt5の必要なパッケージのビルドをする。
(quickcontrolあたりはQtQuickを使うために必要そうなので入れた。)
➜ opt cd qt5 ➜ qt5 git:(5.7) ✗ cd qtimageformats ➜ qtimageformats git:(5.7) ✗ git checkout 5.7 && /usr/local/qt5pi/bin/qmake . && make -j 4 && sudo make install
とすると
/mnt/rasp-pi-rootfs/usr/local/qt5pi/lib/
の中に***.soがインストールされていく。
この続きはQtのサイトと同じくsyncしてddでSDカードに書き込んで起動する。
Qt Designerの設定はここと同じ
修正版