IT 技術家 http://blog.itist.tw/p/rpi.html
來源 http://www.it610.com/article/2077145.htm
Raspberry Pi (BCM2835): Device Information
| Architecture | ARMv6 |
|---|---|
| CPU | ARM11 |
| RAM | 256MB OR 512MB since October 2012 (shared with GPU) |
| GPU | VideoCore IV |
| OpenGL | OpenGL ES 2.0 |
| Multimedia | OpenMax IL 1.1.2 |
| Qt 5.0 (eglfs/QPA) | Supported, with OpenGL ES 2.0 |
Qt 5 port functional state (against Raspbian Wheezy (primary reference platform))
| Feature | State | Additional info |
|---|---|---|
| Hardware accelerated cursor | Done | upstream |
| Wayland support | Done | upstream |
| Hardware decoding of images | To Do | |
| Scenegraph tailoring | To Do | |
| HardFP support | Done | Requires v8 patch |
| Qt Multimedia | Done | Requires gst-omx |
| Webkit integration | To Do | webgl, tex mapper |
開始
首先我們先創建一個目錄來存放Qt5的源代碼以及交叉編譯所需要的所有文件,我選擇在當前用戶家目錄下創建一個叫做“opt”的目錄。1diveinedu@debian :~$mkdir~/opt2diveinedu@debian :~$cd~/opt然後,下載以下文件:下載Raspbian Wheezy鏡像(這裡下載 [raspberrypi.org] ):1diveinedu@debian :~/opt$ wget http://downloads.raspberrypi.org/images/raspbian/2013-02-09-wheezy-raspbian/2013-02-09-wheezy-raspbian.zip2diveinedu@debian :~/opt$unzip 2013-02-09-wheezy-raspbian.zip下載解壓完後掛載鏡像:1diveinedu@debian :~/opt$sudomkdir/mnt/rasp-pi-rootfs2diveinedu@debian:~/opt$sudomount-o loop,offset=62914560 2013-03-09-wheezy-raspbian.img/mnt/rasp-pi-rootfs我們這不介紹交叉工具鏈的編譯,直接下載針對樹莓派優化定制的交叉編譯工具鏈(或者用github上樹莓派的工具鏈https://github.com/raspberrypi/tools):1diveinedu@debian:~/opt$ wget http://blueocean.qmh-project.org/gcc-4.7-linaro-rpi-gnueabihf.tbz2diveinedu@debian:~/opt$tar-xf gcc-4.7-linaro-rpi-gnueabihf.tbz因為上面的交叉編譯工具是32位Linux的,如果你所使用的是64位Linux的話,還需要安裝32位的運行庫軟件包:1diveinedu@debian:~/opt$sudoapt-getinstallia32-libs如果用的是Debian Wheezy的64位系統,上面的行不通,因為Debian Wheezy 64位開啟了multiarch-support ,需要執行:1diveinedu@debian:~/opt$ sudo apt-get install multiarch-support2diveinedu@debian:~/opt$ sudo dpkg --add-architecture i3863diveinedu@debian:~/opt$ sudo apt-get update4diveinedu@debian:~/opt$ sudo apt-get install ia32-libs從遠程倉庫克隆一份cross-compile-tools到本地:1diveinedu@debian:~/opt$ git clone git://gitorious.org/cross-compile-tools/cross-compile-tools.git從遠程倉庫克隆一份Qt5的源碼庫到本地:1diveinedu@debian:~/opt$ git clone git://gitorious.org/qt/qt5.git2diveinedu@debian:~/opt$cdqt53diveinedu@debian:~/opt/qt5$ ./init-repository最後,把qtjsbackend子項目打補丁讓其支持armv6指令集的樹莓派:1diveinedu@debian:~/opt/qt5$cd~/opt/qt5/qtjsbackend2diveinedu@debian:~/opt/qt5$ git fetch https://codereview.qt-project.org/p/qt/qtjsbackendrefs/changes/56/27256/4&& git cherry-pick FETCH_HEAD如果有衝突的話就解決衝突的代碼。編譯qtbase
現在我們已經準備好了為樹莓派交叉編譯Qt5所需要的全部資源,在正式編譯之前只需要執行一個小腳本來修正一下符號鏈接和庫文件路徑設置:1diveinedu@debian:~/opt/qt5$cd~/opt/cross-compile-tools2diveinedu@debian:~/opt/qt5$sudo./fixQualifiedLibraryPaths/mnt/rasp-pi-rootfs/~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc進入qt5/qtbase目錄執行以下腳本進行配置和編譯工作:1diveinedu@debian:~/opt/qt5$cd~/opt/qt5/qtbase2diveinedu@debian:~/opt/qt5/qtbase$ ./configure-opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin /arm-linux-gnueabihf--sysroot/mnt/rasp-pi-rootfs-opensource -confirm-license -optimized-qmake -reduce-relocations -reduce-exports -release -makelibs -prefix/usr/local/qt5pi-no -pch3diveinedu@debian:~/opt/qt5/qtbase$make-j 44diveinedu@debian:~/opt/qt5/qtbase$sudomakeinstall編譯其他模塊
執行到這步的時候,你已經有了針對樹莓派交叉編譯的qmake工具了,你可以一一的去交叉編譯Qt5的其他模塊了,為裡避免模塊編譯過程中可能出現的依賴錯誤,建議按照這個模塊順序去編譯: qtimageformats, qtsvg, qtjsbackend, qtscript, qtxmlpatterns, qtdeclarative, qtsensors, qt3d, qtgraphicaleffects,qtjsondb,qtlocation, qtdocgallery.模塊編譯相關的類似命令:1diveinedu@debian:~/opt/qt5$cdqtimageformats2diveinedu@debian:~/opt/qt5/qtimageformats$/usr/local/qt5pi/bin/qmake.3diveinedu@debian:~/opt/qt5/qtimageformats$make-j44diveinedu@debian:~/opt/qt5/qtimageformats$sudomakeinstall把你所需要或者所想編譯的模塊都按順序執行編譯安裝命令後,所有需要的東西都安裝在了鏡像文件(raspbain wheezy image)裡面了。我們接下來就是把他燒到SD卡上去。SD卡燒寫命令:1diveinedu@debian:~/opt/qt5$cd~/opt/2diveinedu@debian:~/opt$sync;sudoumount/mnt/rasp-pi-rootfs3diveinedu@debian:~/opt$sudoddbs=1Mif=2013-02-09-wheezy-raspbian.img of=/dev/sdc;sync提示:/dev/sdc是我使用的SD的設備, 請根據自己的實際情況修改。到這裡,樹莓派的Qt5運行庫的編譯移植過程就Done了。後續會有例程Demo以及Qt5的QPA機制在樹莓派上的eglfs平台插件的特點介紹和傳統QtWidget程序在EGLFS環境下遇到的問題和解決分析。///--------------------------------------------------end---------------------------------------------//
來源 http://wiki.qt.io/Apt-get_Qt4_on_the_Raspberry_Pi
Apt-get Qt4 on the Raspberry Pi
Contents
[hide]Tutorial : apt-get install Qt4 on the Rasperry Pi
1.apt-get
Firstly I got the development tools needed by Qt Creator in the hope it would be less heavy for the Pi to download separately.
sudo apt-get install qt4-dev-tools
Then I went for Qt Creator
sudo apt-get install qtcreator
I also installed
sudo apt-get install gcc sudo apt-get install xterm sudo apt-get install git-core sudo apt-get install subversion
this gives as a result Qt Creator 2.5 with Qt 4.8.1 32 bit
Problem : no toolchain.
We can only compile for remote embedded devices and this is not the case here, because we are on the Pi and not remotely accessing it.
I added a gcc toolchain
Tools/Options > build & run > tab tool chains > button add Choose GCC
- Then set compiler path : /usr/bin/arm-linux-gnueabihf-gcc-4.6
- Debugger : /usr/bin/gdb
- Mkspec : default
Qt Creator seems to detect that we are going to deploy on a remote target.
To fix this :
- Go to menu help > about plugins
- Uncheck device support > remote linux
- Restart Qt Creator
- Go to tools > options TAB > build & run > Qt versions > add "/usr/bin/qmake-qt4"
It will then show up as a desktop project in the project wizard instead of embedded.
沒有留言:
張貼留言