imx6ull+debian10 构建静态qt交叉编译环境

# PC:Ubuntu18.04
# GCC: arm-linux-gnueabihf- 7.4.0
# 开发板:
# imx6ull+debian10(文件系统为野火提供的)

# 此处需要编译的是带gstreamer的qt 静态库,仅着重说明安装gstreamer的库,忽略其他工具的安装
# 参考:太多,忘了大部分
https://wiki.qt.io/RaspberryPi2EGLFS

#期间PC端安装了同样的库,但好像没什么用
# 开发板安装gstreamer相关库,还安装了其他库(试错太多,忘了)
apt-get install libgstreamer1.0-dev
# 本人安装了以下的库才解决问题: ERROR: Feature 'gstreamer_1_0' was enabled, but the pre-condition 'libs.gstreamer_1_0' failed.
apt-get install gstreamer1.0-omx libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
# 安装以上库即可编译qt
# 开发板安装一下库解决运行报错:
# GStreamer-CRITICAL: gst_element_get_static_pad: assertion 'GST_IS_ELEMENT (element)' failed
apt-get install libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools


# 建立开发板的文件系统
# 建立文件夹
# 参考: https://wiki.qt.io/RaspberryPi2EGLFS
# 8.[on host PC] Create a sysroot. Using rsync we can properly keep things synchronized in the future as well. Replace raspberrypi.local with the address of the Pi

mkdir sysroot sysroot/usr sysroot/opt
rsync -avz pi@raspberrypi.local:/lib sysroot
rsync -avz pi@raspberrypi.local:/usr/include sysroot/usr
rsync -avz pi@raspberrypi.local:/usr/lib sysroot/usr

# 配置qt,直接解压源码,不需要对源码进行任何更改,qt版本相差不大应该都可以
./configure -static -prefix /opt/imx6/qt-5.9.8-static -extprefix /opt/imx6/qt-5.9.8-static \
-device linux-imx7-g++ \
-device-option CROSS_COMPILE=arm-linux-gnueabihf- \
-sysroot /../../../../../../home/greg/imx6/debian10sysroots \
-no-openssl -no-cups -no-iconv -qt-zlib \
-no-opengl -no-sse2 -no-xcb \
-nomake examples -nomake tests -v -opensource \
-skip qt3d -skip qtcanvas3d -skip webengine -skip qtpurchasing \
-skip qtquickcontrols -skip qtquickcontrols2 -skip qtsensors -skip qtdoc -skip qtwayland \
-confirm-license -qreal double -gstreamer 1.0
# -static 设置静态编译,默认动态
# 其他配置可根据实际需要增删
# 以上文件系统也许可以用库连接代替,未测试
# -sysroot 为目标使用的根文件系统,可从开发板直接获取相关库,这里的文件系统直接从SD卡里复制整个文件
# 注意:此处文件系统必须保证存在,否则无法编译qt程序(需要用的里面的动态库)

# 配置成功
make -j8
# 慢的电脑要20~30分钟,快的10~20分钟,再快的不到10分钟

make install

#运行时,开发板需要在qt安装目录中的lib建立fonts,存放字体文件
mkdir -p /opt/imx6/qt-5.9.8-static/lib/fonts/
cp 字体文件 /opt/imx6/qt-5.9.8-static/lib/fonts/

posted @ 2020-01-16 17:13  GregTse  阅读(1163)  评论(1编辑  收藏  举报