從零開始移植QT4.8.5之三--linux下交叉編譯QT執行庫
這篇文章要實現的目標是在linux下交叉編譯QT在嵌入式裝置OK6410的執行庫,最終在OK6410上執行QT演示程式。
1、觸控式螢幕庫檔案安裝tslib
首先如果嵌入式裝置上有觸控式螢幕,需要先移植tslib,這個不是本次的重點,所以我們就直接搭建編譯的時候需要的tslib庫,因為飛凌官方已經提供編譯好了的庫檔案,所以之需要解壓把庫檔案放到對應的位置就可以了。
編譯好的tslib檔案下載:http://download.csdn.net/detail/andylauren/9583536
解壓到準備好的目錄,這個目錄需要記住,後面在編譯QT的時候會用到,我的路徑是/home/linux/arm/tslib目錄下。
2、交叉編譯qt-everywhere-opensource-src
需要在上一篇文章中的壓縮包qt-everywhere-opensource-src-4.8.5.tar.gz,這裡需要重新解壓,因為如果已經configure過的會生成makefile檔案,qt的configure會檢測資料夾中是否有makefile,即使使用make clean也無法完全刪除配置檔案,在編譯的時候可能會產生各種各樣的路徑、編譯庫不一致的錯誤,所以最好的方法就是每次編譯之前都從新解壓。
tar zxvf xxx.tar.gz
解壓之後跳進解壓後的資料夾
輸入如下命令
echo yes | ./configure -opensource -embedded arm -xplatform qws/linux-arm-g++ -no-webkit -qt-libtiff -qt-libmng -qt-mouse-tslib -qt-mouse-pc -no-mouse-linuxtp -prefix /home/linux/arm/qt-4.8.5-arm -I /home/linux/arm/tslib/include -L /home/linux/arm/tslib/lib
這裡說明幾個重要的設定
-prefix /home/linux/arm/qt-4.8.5-arm 這個是編譯好的檔案的目錄,這個目錄很重要,因為在開發板上也要將庫檔案放在這個目錄中,所以需要謹慎選擇。
-I /home/linux/arm/tslib/include 這個是剛剛解壓好的tslib庫的路徑下的include
-L /home/linux/arm/tslib/lib 這個是剛剛解壓好的tslib庫的路徑下的lib
這幾個需要根據自己的需求修改。
然後等著configure完成之後就可以經典的make&&make install
沒有意外的話就會在/home/linux/arm/qt-4.8.5-arm路徑下生成編譯好的庫檔案
3、提取開發板需要的庫檔案
提取檔案寫了一個指令碼,之需要其中的檔案路徑即可。下載地址:http://download.csdn.net/detail/andylauren/9583815
#!/bin/bash
TARGET_DIR=$PWD
cd /
list=`cat << EOF
home/linux/arm/qt-4.8.5-arm/examples/widgets/wiggly/wiggly
home/linux/arm/qt-4.8.5-arm/examples/painting/concentriccircles/concentriccircles
home/linux/arm/qt-4.8.5-arm/lib/libQtSql.so.4.8.5
home/linux/arm/qt-4.8.5-arm/lib/libQtXml.so.4.8
home/linux/arm/qt-4.8.5-arm/lib/libQtSvg.so.4.8.5
home/linux/arm/qt-4.8.5-arm/lib/libQtSql.so.4
home/linux/arm/qt-4.8.5-arm/lib/libQtScript.so.4
home/linux/arm/qt-4.8.5-arm/lib/libQtXml.so
home/linux/arm/qt-4.8.5-arm/lib/libQtMultimedia.so.4.8.5
home/linux/arm/qt-4.8.5-arm/lib/libQtScriptTools.so.4
home/linux/arm/qt-4.8.5-arm/lib/libQtGui.so
home/linux/arm/qt-4.8.5-arm/lib/libQtSql.so
home/linux/arm/qt-4.8.5-arm/lib/libQtGui.so.4.8.5
home/linux/arm/qt-4.8.5-arm/lib/libQtXml.so.4.8.5
home/linux/arm/qt-4.8.5-arm/lib/libQtCore.so
home/linux/arm/qt-4.8.5-arm/lib/libQtGui.so.4
home/linux/arm/qt-4.8.5-arm/lib/libQt3Support.so.4
home/linux/arm/qt-4.8.5-arm/lib/libQtTest.so.4.8
home/linux/arm/qt-4.8.5-arm/lib/libQtCore.so.4.8
home/linux/arm/qt-4.8.5-arm/lib/fonts/unifont_160_50.qpf
home/linux/arm/qt-4.8.5-arm/lib/libQtSvg.so.4.8
home/linux/arm/qt-4.8.5-arm/lib/libQtNetwork.so.4
home/linux/arm/qt-4.8.5-arm/lib/libQt3Support.so.4.8
home/linux/arm/qt-4.8.5-arm/lib/libQtScript.so.4.8.5
home/linux/arm/qt-4.8.5-arm/lib/libQtScriptTools.so.4.8
home/linux/arm/qt-4.8.5-arm/lib/libQtNetwork.so
home/linux/arm/qt-4.8.5-arm/lib/libQtScript.so.4.8
home/linux/arm/qt-4.8.5-arm/lib/libQtNetwork.so.4.8
home/linux/arm/qt-4.8.5-arm/lib/libQtTest.so.4.8.5
home/linux/arm/qt-4.8.5-arm/lib/libQtSql.so.4.8
home/linux/arm/qt-4.8.5-arm/lib/libQtMultimedia.so.4
home/linux/arm/qt-4.8.5-arm/lib/libQtTest.so
home/linux/arm/qt-4.8.5-arm/lib/libQt3Support.so.4.8.5
home/linux/arm/qt-4.8.5-arm/lib/libQtTest.so.4
home/linux/arm/qt-4.8.5-arm/lib/libQtCore.so.4.8.5
home/linux/arm/qt-4.8.5-arm/lib/libQtScriptTools.so
home/linux/arm/qt-4.8.5-arm/lib/libQtMultimedia.so.4.8
home/linux/arm/qt-4.8.5-arm/lib/libQtSvg.so
home/linux/arm/qt-4.8.5-arm/lib/libQtXml.so.4
home/linux/arm/qt-4.8.5-arm/lib/libQtCore.so.4
home/linux/arm/qt-4.8.5-arm/lib/libQtScriptTools.so.4.8.5
home/linux/arm/qt-4.8.5-arm/lib/libQtNetwork.so.4.8.5
home/linux/arm/qt-4.8.5-arm/lib/libQtMultimedia.so
home/linux/arm/qt-4.8.5-arm/lib/libQtScript.so
home/linux/arm/qt-4.8.5-arm/lib/libQtGui.so.4.8
home/linux/arm/qt-4.8.5-arm/lib/libQt3Support.so
home/linux/arm/qt-4.8.5-arm/lib/libQtSvg.so.4
home/linux/arm/qt-4.8.5-arm/plugins/sqldrivers/libqsqlite.so
home/linux/arm/qt-4.8.5-arm/plugins/accessible/libqtaccessiblewidgets.so
home/linux/arm/qt-4.8.5-arm/plugins/accessible/libqtaccessiblecompatwidgets.so
home/linux/arm/qt-4.8.5-arm/plugins/iconengines/libqsvgicon.so
home/linux/arm/qt-4.8.5-arm/plugins/imageformats/libqico.so
home/linux/arm/qt-4.8.5-arm/plugins/imageformats/libqsvg.so
home/linux/arm/qt-4.8.5-arm/plugins/imageformats/libqtiff.so
home/linux/arm/qt-4.8.5-arm/plugins/imageformats/libqjpeg.so
home/linux/arm/qt-4.8.5-arm/plugins/imageformats/libqmng.so
home/linux/arm/qt-4.8.5-arm/plugins/imageformats/libqgif.so
home/linux/arm/qt-4.8.5-arm/demos/deform/deform
home/linux/arm/qt-4.8.5-arm/demos/deform/pathdeform.html
home/linux/arm/qt-4.8.5-arm/demos/embedded/embeddedsvgviewer/spheres.svg
home/linux/arm/qt-4.8.5-arm/demos/embedded/embeddedsvgviewer/embeddedsvgviewer
home/linux/arm/qt-4.8.5-arm/demos/embedded/embeddedsvgviewer/shapes.svg
home/linux/arm/qt-4.8.5-arm/demos/embedded/embeddedsvgviewer/files/default.svg
home/linux/arm/qt-4.8.5-arm/demos/embedded/embeddedsvgviewer/files/v-slider-handle.svg
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/embeddedsvgviewer.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/desktopservices_s60.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/deform.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/flightinfo_s60.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/raycasting.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/digiflip.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/styledemo.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/styledemo_s60.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/mediaplayer.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/weatherinfo.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/concentriccircles.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/context2d_s60.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/wiggly.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/lightmaps.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/elasticnodes.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/wiggly_s60.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/ftp_s60.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/embeddedsvgviewer_s60.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/anomaly_s60.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/flickable.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/softkeys_s60.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/fridgemagnets_s60.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/saxbookmarks_s60.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/screenshots/pathstroke.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/slides/demo_4.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/slides/demo_1.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/slides/demo_2.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/slides/demo_6.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/slides/demo_3.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/slides/demo_5.png
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/fluidlauncher
home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher/config.xml
home/linux/arm/qt-4.8.5-arm/demos/embedded/styledemo/styledemo
home/linux/arm/qt-4.8.5-arm/demos/pathstroke/pathstroke.html
home/linux/arm/qt-4.8.5-arm/demos/pathstroke/pathstroke
EOF
`
tar cfvz $TARGET_DIR/target-qte-4.8.5.tgz $list
根據自己的需要修改home/linux/arm/qt-4.8.5-arm路徑,如果QT的版本改變可以根據自己需要修改其中對應的版本號,4.8.5和4.8,其他的內容基本不需要改變。
然後在任何路徑下執行這個指令碼就可以。完成後在當前目錄中會生成target-qte-4.8.5.tgz檔案,我生成的檔案在下面下載:http://download.csdn.net/detail/andylauren/9583545
之後把target-qte-4.8.5.tgz檔案拷貝到開發板的根目錄下,然後解壓就可以了,之後就會在開發板的/home/linux/arm/qt-4.8.5-arm目錄下會有QT庫檔案了。
到這個時候就可以在開發板上執行QT程式了,下面我們提供一個QT演示程式的指令碼檔案。
4、QT演示程式指令碼檔案
具體檔案如下
#!/bin/sh
base1=qpe
pid=`/bin/pidof $base1`
if [ -n "$pid" ]; then
killall $base1
fi
base2=qss
pid=`/bin/pidof $base2`
if [ -n "$pid" ]; then
killall $base2
fi
base3=quicklauncher
pid=`/bin/pidof $base3`
if [ -n "$pid" ]; then
killall $base3
fi
base4=fluidlauncher
pid=`/bin/pidof $base4`
if [ -n "$pid" ]; then
killall $base4
fi
export TSLIB_ROOT=/usr/local/tslib
export TSLIB_TSDEVICE=/dev/input/event2
export TSLIB_TSEVENTTYPE=H3600
export TSLIB_CONFFILE=/usr/local/tslib/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/local/tslib/lib/ts
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export QTDIR=/home/linux/arm/qt-4.8.5-arm/
export LD_LIBRARY_PATH=$QTDIR/plugins/qtopialmigrate/:$QTDIR/qt_plugins/imageformats/:$QTDIR/lib:/root/tslib/build/lib:$LD_LIBRARY_PATH
export PATH=/bin:/sbin:/usr/bin/:/usr/sbin:/root/tslib/build/bin
if [ -c /dev/input/event2 ]; then
export QWS_MOUSE_PROTO="Tslib:${TSLIB_TSDEVICE}"
if [ -e /etc/pointercal -a ! -s /etc/pointercal ] ; then
rm /etc/pointercal
/root/tslib/build/bin/ts_calibrate
fi
else
export QWS_MOUSE_PROTO="MouseMan:/dev/input/mice"
>/etc/pointercal
fi
export QWS_KEYBOARD=TTY:/dev/tty1
FB_SIZE=$(cat /sys/class/graphics/fb0/virtual_size)
#export QWS_DISPLAY="LinuxFb:mmWidth76:mmHeight44:1"
case "$FB_SIZE" in
800,480)
export QWS_DISPLAY="LinuxFb:mmWidth91:mmHeight53:1"
;;
480,272)
export QWS_DISPLAY="LinuxFb:mmWidth76:mmHeight44:1"
;;
*)
export QWS_DISPLAY="LinuxFb:mmWidth91:mmHeight53:1"
;;
esac
#export QWS_DISPLAY=:1
export HOME=/root/QtE4Home
cd /home/linux/arm/qt-4.8.5-arm/demos/embedded/fluidlauncher
./fluidlauncher -qws
這個指令碼只能在OK6410開發板4.3寸螢幕上執行,具體的內容請讀者自己閱讀,下一篇文章我們會一起自己寫一個QT程式執行起來。那個時候我們來對自己的程式一些環境配置具體的講解。
相關文章
- 11_QT跨平臺執行之把QT程式交叉編譯到ARM開發板QT編譯
- 09_QT系統移植之交叉編譯QT原始碼和觸控原始碼QT編譯原始碼
- 從零開始學typescript— 自動編譯TypeScript編譯
- 關於Gdb工具的交叉編譯、移植編譯
- 從零開始在Linux編譯VLC-Android開源專案Linux編譯Android
- ubuntu16交叉編譯Qt5.9Ubuntu編譯QT
- 交叉編譯Qt/E和Qtopia過程編譯QT
- 從零開始-基礎流程圖編輯庫流程圖
- ubuntu下編譯交叉編譯工具鏈Ubuntu編譯
- 幾何庫從零開始
- linux與windows交叉編譯LinuxWindows編譯
- 【許曉笛】從零開始執行EOS系統
- linux下QT在windows下執行LinuxQTWindows
- 從零開始編寫指令碼引擎指令碼
- 交叉編譯編譯
- FFmpeg開發筆記(十六)Linux交叉編譯Android的OpenSSL庫筆記Linux編譯Android
- FFmpeg開發筆記(八)Linux交叉編譯Android的FFmpeg庫筆記Linux編譯Android
- bluez藍芽協議棧交叉編譯移植教程(附帶視訊下載地址)藍芽協議編譯
- Re從零開始的UI庫編寫生活之表格元件UI元件
- Re從零開始的UI庫編寫生活之表單UI
- Re從零開始的UI庫編寫生活之按鈕UI
- Linux下編譯生成SO並進行呼叫執行Linux編譯
- 10_QT系統移植之在開發板上部署QT執行環境QT
- C程式從編譯到執行C程式編譯
- Re從零開始的UI庫編寫生活之規範制定UI
- lazarus交叉編譯編譯
- qt編譯報錯 無法執行“rc.exe”QT編譯
- 從零開始瞭解多執行緒知識之開始篇目 -- jvm&volatile執行緒JVM
- 從Oclint開始接觸Clang編譯編譯
- 從零開始編寫一個babel外掛Babel
- 從零開始編寫自己的JavaScript框架(一)JavaScript框架
- 從零開始編寫自己的JavaScript框架(二)JavaScript框架
- 從零開始機器學習機器學習
- 從零開始 OpenCVOpenCV
- 從零開始JVM(一):初探JVM執行時資料區域JVM
- Re從零開始的UI庫編寫生活之進度條元件UI元件
- 從 Linux 終端編譯執行 Eclipse Java 專案Linux編譯EclipseJava
- 交叉編譯入門編譯