# PC:Ubuntu18.04
# GCC: arm-linux-gnueabihf- 7.4.0
# 開發板:
# imx6ull+debian10(文件系統爲野火提供的)linux
# 此處須要編譯的是帶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-toolsweb
# 創建開發板的文件系統
# 創建文件夾
# 參考: 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 Picanvas
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 ui
#運行時,開發板須要在qt安裝目錄中的lib創建fonts,存放字體文件
mkdir -p /opt/imx6/qt-5.9.8-static/lib/fonts/
cp 字體文件 /opt/imx6/qt-5.9.8-static/lib/fonts/3d