这篇文章主要介绍了树莓派如何实现Qt5交叉编译移植,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

成都创新互联公司服务项目包括定西网站建设、定西网站制作、定西网页制作以及定西网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,定西网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到定西省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!
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”的目录。 - 1- diveinedu@debian :~$- mkdir- ~- /opt- 2- diveinedu@debian :~$- cd- ~- /opt- 然后,下载以下文件: - 下载Raspbian Wheezy 镜像 (这里下载 [raspberrypi.org]): - 1- diveinedu@debian :~- /opt- $ wget http:- //downloads- .raspberrypi.org- /images/raspbian/2013-02-09-wheezy-raspbian/2013-02-09-wheezy-raspbian- .zip- 2- diveinedu@debian :~- /opt- $unzip 2013-02-09-wheezy-raspbian.zip- 下载解压完后挂载镜像: - 1- diveinedu@debian :~- /opt- $- sudo- mkdir- /mnt/rasp-pi-rootfs- 2- diveinedu@debian:~- /opt- $- sudo- mount- -o loop,offset=62914560 2013-03-09-wheezy-raspbian.img- /mnt/rasp-pi-rootfs- 我们这不介绍交叉工具链的编译,直接下载针对树莓派优化定制的交叉编译工具链(或者用github上树莓派的工具链https://github.com/raspberrypi/tools): - 1- diveinedu@debian:~- /opt- $ wget http:- //blueocean- .qmh-project.org- /gcc-4- .7-linaro-rpi-gnueabihf.tbz- 2- diveinedu@debian:~- /opt- $- tar- -xf gcc-4.7-linaro-rpi-gnueabihf.tbz- 因为上面的交叉编译工具是32位Linux的,如果你所使用的是64位Linux的话,还需要安装32位的运行库软件包: - 1- diveinedu@debian:~- /opt- $- sudo- apt-get- install- ia32-libs- 如果用的是Debian Wheezy的64位系统,上面的行不通,因为Debian Wheezy 64位开启了multiarch-support ,需要执行: - 1- diveinedu@debian:~/opt$ sudo apt-get install multiarch-support- 2- diveinedu@debian:~/opt$ sudo dpkg --add-architecture i386- 3- diveinedu@debian:~/opt$ sudo apt-get update- 4- diveinedu@debian:~/opt$ sudo apt-get install ia32-libs- 从远程仓库克隆一份cross-compile-tools到本地: - 1- diveinedu@debian:~- /opt- $ git clone git:- //gitorious- .org- /cross-compile-tools/cross-compile-tools- .git- 从远程仓库克隆一份Qt5的源码库到本地: - 1- diveinedu@debian:~- /opt- $ git clone git:- //gitorious- .org- /qt/qt5- .git- 2- diveinedu@debian:~- /opt- $- cd- qt5- 3- diveinedu@debian:~- /opt/qt5- $ .- /init-repository- 最后,把qtjsbackend子项目打补丁让其支持armv6指令集的树莓派: - 1- diveinedu@debian:~- /opt/qt5- $- cd- ~- /opt/qt5/qtjsbackend- 2- diveinedu@debian:~- /opt/qt5- $ git fetch https:- //codereview- .qt-project.org- /p/qt/qtjsbackend- refs- /changes/56/27256/4- && git cherry-pick FETCH_HEAD- 如果有冲突的话就解决冲突的代码。 
- 编译qtbase- 现在我们已经准备好了为树莓派交叉编译Qt5所需要的全部资源,在正式编译之前只需要执行一个小脚本来修正一下符号链接和库文件路径设置: - 1- diveinedu@debian:~- /opt/qt5- $- cd- ~- /opt/cross-compile-tools- 2- diveinedu@debian:~- /opt/qt5- $- sudo- .- /fixQualifiedLibraryPaths- /mnt/rasp-pi-rootfs/- ~- /opt/gcc-4- .7-linaro-rpi-gnueabihf- /bin/arm-linux-gnueabihf-gcc- 进入qt5/qtbase目录执行以下脚本进行配置和编译工作: - 1- diveinedu@debian:~- /opt/qt5- $- cd- ~- /opt/qt5/qtbase- 2- diveinedu@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 -- make- libs -prefix- /usr/local/qt5pi- -no-pch- 3- diveinedu@debian:~- /opt/qt5/qtbase- $- make- -j 4- 4- diveinedu@debian:~- /opt/qt5/qtbase- $- sudo- make- install
- 编译其他模块- 执行到这步的时候,你已经有了针对树莓派交叉编译的qmake工具了,你可以一一的去交叉编译Qt5的其他模块了,为里避免模块编译过程中可能 出现的依赖错误,建议按照这个模块顺序去编译: qtimageformats, qtsvg, qtjsbackend, qtscript, qtxmlpatterns, qtdeclarative, qtsensors, qt3d, qtgraphicaleffects,qtjsondb,qtlocation, qtdocgallery. - 模块编译相关的类似命令: - 1- diveinedu@debian:~- /opt/qt5- $- cd- qtimageformats- 2- diveinedu@debian:~- /opt/qt5/qtimageformats- $- /usr/local/qt5pi/bin/qmake- .- 3- diveinedu@debian:~- /opt/qt5/qtimageformats- $- make- -j4- 4- diveinedu@debian:~- /opt/qt5/qtimageformats- $- sudo- make- install- 把你所需要或者所想编译的模块都按顺序执行编译安装命令后,所有需要的东西都安装在了镜像文件(raspbain wheezy image)里面了。我们接下来就是把他烧到SD卡上去。 SD卡烧写命令: - 1- diveinedu@debian:~- /opt/qt5- $- cd- ~- /opt/- 2- diveinedu@debian:~- /opt- $- sync- ;- sudo- umount- /mnt/rasp-pi-rootfs- 3- diveinedu@debian:~- /opt- $- sudo- dd- bs=1M- if- =2013-02-09-wheezy-raspbian.img of=- /dev/sdc- ;- sync- 提示:/dev/sdc是我使用的SD的设备, 请根据自己的实际情况修改。 
感谢你能够认真阅读完这篇文章,希望小编分享的“树莓派如何实现Qt5交叉编译移植”这篇文章对大家有帮助,同时也希望大家多多支持创新互联,关注创新互联行业资讯频道,更多相关知识等着你来学习!
标题名称:树莓派如何实现Qt5交叉编译移植
标题路径:http://www.scyingshan.cn/article/jeesee.html

 建站
建站
 咨询
咨询 售后
售后
 建站咨询
建站咨询 
 