linux-ubuntu16.04 为树莓派3B 交叉编译qt5.9 心得
2018-01-12 09:52
711 查看
树莓派3B 系统为2016.11.25的 jessie
交叉编译器版本:4.9.4
主机版本:ubuntu 16.04 64位
参考资料:https://www.ics.com/blog/building-qt-5-raspberry-pi
https://www.youtube.com/watch?v=I2vmh0dMzEw http://blog.csdn.net/bona020/article/details/51398969 https://wiki.qt.io/RaspberryPi2EGLFS
qt下载地址:http://download.qt.io/archive/qt/
工具地址:https://github.com/conanwhf/RaspberryPi-script
gcc地址:https://releases.linaro.org/components/toolchain/binaries/
步骤:
1.首先更新树莓派源,速度更快
/etc/apt/sources.list
#阿里云
#Raspbian http://mirrors.aliyun.com/raspbian/raspbian/
deb http://mirrors.aliyun.com/raspbian/raspbian/ jessie main contrib non-free
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ jessie main contrib non-free
#清华大学
#Raspbian http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ jessie main contrib non-free
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ jessie main contrib non-free
#华中科技大学
#Raspbian http://mirrors.hustunique.com/raspbian/raspbian/
deb http://mirrors.hustunique.com/raspbian/raspbian/ jessie main contrib non-free
deb-src http://mirrors.hustunique.com/raspbian/raspbian/ jessie main contrib non-free
sudo apt-get update
sudo apt-get upgrade
2.安装需要的库,安装可能不顺利 自行按提示解决
sudo apt-get install libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev
libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-sync1 libxcb-sync-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-glx0-dev
libfontconfig1-dev
libdbus-1-dev
libfreetype6-dev
libudev-dev
libicu-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
3.备份树莓派系统
https://github.com/conanwhf/RaspberryPi-script
根据此博客,将系统备份到Upan,sudo backup,时间比较漫长.
4.将备份好的系统拷贝到电脑,挂载
offset后面的大小由sudo fdisk -l backup.img 得到 第二个数字×512.
5.修改/mnt/raspberry-rootfs下的库链接
最好先执行一下这个
6. 进入已解压好的qt目录,我下载的qt5.9.2
./configure -opengl es2 -qt-xcb -skip webengine -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=/home/mach/newDisk/e/toolchain/gcc-linaro-4.9.4-arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/raspberry-rootfs -opensource -confirm-license
-optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi
编译选项可以根据configure help自行修改,-device 指定了树莓派的版本,这个也要对应,不要弄错,-system-root 指定树莓派系统挂载路径,-prefix 指定了生成库的安装目录/mnt/raspberry-rootfs/usr/local/qt5pi,-hostprefix指定了构建工具的安装目录,在主机的/usr/local/qt5pi
make
sudo make install
其中,跳过了webengine,因为make时报了一个python的错误 ,暂时还未解决,如有解决的,请联系我,谢谢!
/usr/bin/python2 ../../3rdparty/chromium/third_party/WebKit/Source/build/scripts/make_css_property_names.py ../../3rdparty/chromium/third_party/WebKit/Source/core/css/CSSProperties.in --output_dir gen/blink/core --gperf gperf
Traceback (most recent call last):
File "../../3rdparty/chromium/third_party/WebKit/Source/build/scripts/make_css_property_names.py", line 197, in <module>
in_generator.Maker(CSSPropertyNamesWriter).main(sys.argv)
File "/home/mach/newDisk/e/raspberry/qt-everywhere-opensource-src-5.9.2/qtwebengine/src/3rdparty/chromium/third_party/WebKit/Source/build/scripts/in_generator.py", line 108, in main
writer.write_files(options.output_dir)
File "/home/mach/newDisk/e/raspberry/qt-everywhere-opensource-src-5.9.2/qtwebengine/src/3rdparty/chromium/third_party/WebKit/Source/build/scripts/in_generator.py", line 60, in write_files
self._write_file_if_changed(output_dir, generator(), file_name)
File "../../3rdparty/chromium/third_party/WebKit/Source/build/scripts/make_css_property_names.py", line 192, in generate_implementation
raise subprocess.CalledProcessError(127, gperf_args, output='Command not found.')
subprocess.CalledProcessError: Command '['gperf', '--key-positions=*', '-P', '-n', '-m', '50', '-D', '-Q', 'CSSPropStringPool']' returned non-zero exit status 127
7.如果编译过程中出现错误,大多是因为前面configure配置或者库的错误。一定要仔细认真。
交叉编译器版本:4.9.4
主机版本:ubuntu 16.04 64位
参考资料:https://www.ics.com/blog/building-qt-5-raspberry-pi
https://www.youtube.com/watch?v=I2vmh0dMzEw http://blog.csdn.net/bona020/article/details/51398969 https://wiki.qt.io/RaspberryPi2EGLFS
qt下载地址:http://download.qt.io/archive/qt/
工具地址:https://github.com/conanwhf/RaspberryPi-script
gcc地址:https://releases.linaro.org/components/toolchain/binaries/
步骤:
1.首先更新树莓派源,速度更快
/etc/apt/sources.list
#阿里云
#Raspbian http://mirrors.aliyun.com/raspbian/raspbian/
deb http://mirrors.aliyun.com/raspbian/raspbian/ jessie main contrib non-free
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ jessie main contrib non-free
#清华大学
#Raspbian http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ jessie main contrib non-free
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ jessie main contrib non-free
#华中科技大学
#Raspbian http://mirrors.hustunique.com/raspbian/raspbian/
deb http://mirrors.hustunique.com/raspbian/raspbian/ jessie main contrib non-free
deb-src http://mirrors.hustunique.com/raspbian/raspbian/ jessie main contrib non-free
sudo apt-get update
sudo apt-get upgrade
2.安装需要的库,安装可能不顺利 自行按提示解决
sudo apt-get install libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev
libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-sync1 libxcb-sync-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-glx0-dev
libfontconfig1-dev
libdbus-1-dev
libfreetype6-dev
libudev-dev
libicu-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 apt-get install libudev-dev libinput-dev libts-dev libxcb-xinerama0-dev libxcb-xinerama
3.备份树莓派系统
https://github.com/conanwhf/RaspberryPi-script
根据此博客,将系统备份到Upan,sudo backup,时间比较漫长.
4.将备份好的系统拷贝到电脑,挂载
sudo mount -o loop,offset=62914560 \ raspberry-working-image.img /mnt/raspberry-rootfs
offset后面的大小由sudo fdisk -l backup.img 得到 第二个数字×512.
/dev/loop0p1 8192 122879 57344 c W95 FAT32 /dev/loop0p2 122880 3788799 1832960 83 Linux5.
5.修改/mnt/raspberry-rootfs下的库链接
最好先执行一下这个
$ git clone git://gitorious.org/cross-compile-tools/cross-compile-tools.git $ cd cross-compile-tools
sudo ./fixQualifiedLibraryPaths /mnt/raspberry-rootfs/ ~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc
cd /mnt/raspberry-rootfs/
以下操作在pc机 rootfs 目录 路径要对应好 不要修改了PC机的文件
sudo mv ./usr/lib/arm-linux-gnueabihf/libEGL.so.1.0.0 ./usr/lib/arm-linux-gnueabihf/libEGL.so.1.0.0_backup sudo mv ./usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0 ./usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0_backup sudo ln -s ./opt/vc/lib/libEGL.so ./usr/lib/arm-linux-gnueabihf/libEGL.so.1.0.0 sudo ln -s ./opt/vc/lib/libGLESv2.so ./usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0
sudo ln -s ./opt/vc/lib/libEGL.so ./opt/vc/lib/libEGL.so.1 sudo ln -s ./opt/vc/lib/libGLESv2.so ./opt/vc/lib/libGLESv2.so.2
cd /usr/lib/arm-linux-gnueabihf; ls查看库信息,重点注意红色的库 链接已经错了,手动修改
sudo ln -sf ./opt/vc/lib/*.so ./usr/lib/arm-linux-gnueabihf/*.so* 具体名字根据当前存在的名字来写,可能需要修改很多很多,嫌麻烦的可以写脚本来执行。
修改完毕后 继续执行下面动作。
6. 进入已解压好的qt目录,我下载的qt5.9.2
./configure -opengl es2 -qt-xcb -skip webengine -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=/home/mach/newDisk/e/toolchain/gcc-linaro-4.9.4-arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/raspberry-rootfs -opensource -confirm-license
-optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi
编译选项可以根据configure help自行修改,-device 指定了树莓派的版本,这个也要对应,不要弄错,-system-root 指定树莓派系统挂载路径,-prefix 指定了生成库的安装目录/mnt/raspberry-rootfs/usr/local/qt5pi,-hostprefix指定了构建工具的安装目录,在主机的/usr/local/qt5pi
make
sudo make install
其中,跳过了webengine,因为make时报了一个python的错误 ,暂时还未解决,如有解决的,请联系我,谢谢!
/usr/bin/python2 ../../3rdparty/chromium/third_party/WebKit/Source/build/scripts/make_css_property_names.py ../../3rdparty/chromium/third_party/WebKit/Source/core/css/CSSProperties.in --output_dir gen/blink/core --gperf gperf
Traceback (most recent call last):
File "../../3rdparty/chromium/third_party/WebKit/Source/build/scripts/make_css_property_names.py", line 197, in <module>
in_generator.Maker(CSSPropertyNamesWriter).main(sys.argv)
File "/home/mach/newDisk/e/raspberry/qt-everywhere-opensource-src-5.9.2/qtwebengine/src/3rdparty/chromium/third_party/WebKit/Source/build/scripts/in_generator.py", line 108, in main
writer.write_files(options.output_dir)
File "/home/mach/newDisk/e/raspberry/qt-everywhere-opensource-src-5.9.2/qtwebengine/src/3rdparty/chromium/third_party/WebKit/Source/build/scripts/in_generator.py", line 60, in write_files
self._write_file_if_changed(output_dir, generator(), file_name)
File "../../3rdparty/chromium/third_party/WebKit/Source/build/scripts/make_css_property_names.py", line 192, in generate_implementation
raise subprocess.CalledProcessError(127, gperf_args, output='Command not found.')
subprocess.CalledProcessError: Command '['gperf', '--key-positions=*', '-P', '-n', '-m', '50', '-D', '-Q', 'CSSPropStringPool']' returned non-zero exit status 127
7.如果编译过程中出现错误,大多是因为前面configure配置或者库的错误。一定要仔细认真。
相关文章推荐
- Qt5.7.1 树莓派3B+ 2016-09-23-raspbian-jessie.img 交叉编译 ubuntu16.04
- Ubuntu16.04交叉编译树莓派Linux-Kernel并打RT-Patch
- ok6410[001] Ubuntu 16.04[64bit]嵌入式交叉编译环境arm-linux-gcc搭建过程图解
- Ubuntu 16.04上用CMake图形界面交叉编译树莓派的OpenCV3.0
- 64位Ubuntu 16.04搭建嵌入式交叉编译环境arm-linux-gcc过程图解
- ubuntu16.04 64bit安装arm-none-linux-gnueabi交叉编译工具链
- Ubuntu 16.04搭建交叉编译环境arm-linux-gcc遇到的问题
- Ubuntu 16.04 安装 arm 树莓派3 交叉编译工具
- ubuntu 16.04 qt 5.5教程编译环境的搭建,ubuntu i.mx6 qt交叉编译环境搭建
- 64位Ubuntu 16.04搭建嵌入式交叉编译环境arm-linux-gcc过程图解
- Ubuntu 16.04[64bit]嵌入式交叉编译环境arm-linux-gcc搭建过程图解
- 在ubuntu-16.04系统中安装arm-linux-gcc-4.3.2交叉编译工具
- Ubuntu 16.04[64bit]嵌入式交叉编译环境arm-linux-gcc搭建过程图解
- Ubuntu 16.04 安装arm-linux-gcc交叉编译
- ubuntu 16.04 64bits 交叉编译openssl到arm-linux
- Ubuntu 16.04[64bit]嵌入式交叉编译环境arm-linux-gcc搭建过程图解
- ubuntu16交叉编译Qt5.9
- Ubuntu16.04安装配置嵌入式交叉编译工具链arm-linux-gcc
- Ubuntu树莓派交叉编译qt5.8 +mysql数据库驱动文件.so
- Ubuntu,TQ2440,arm-linux,Qt交叉编译环境配置