1. 程式人生 > >QT移植筆記

QT移植筆記

1.tslib移植和測試
1.1、tslib移植
(1)原始碼下載
(2)解壓        tar -xvf tslib-1.4.tar.gz
(3)配置
# cd tslib
# ./autogen.sh
# echo "ac_cv_func_malloc_0_nonnull=yes">arm-linux.cache 
# mkdir /opt/tslib
# ./configure --prefix=/opt/tslib --host=arm-linux --cache-file=arm-linux.cache
(4)編譯和安裝
# make
# make install
1.2、問題及解決:
如果./autogen.sh時報錯:./autogen.sh: 4: autoreconf: not found,是因為系統中沒有安裝autoconf工具,解決方法:先讓ubuntu能上網,然後執行:sudo apt-get install autoconf automake libtool
1.3、部署
(1)動態庫檔案so
(2)配置檔案
(3)bin檔案
1.4、匯出環境變數
(2)定義tslib執行需要的環境變數 以下的環境變數匯出是放在/etc/profile下


export TSLIB_TSDEVICE=/dev/input/event2
export TSLIB_CALIBFILE=/tslib1.4/etc/pointercal
export TSLIB_CONFFILE=/tslib1.4/etc/ts.conf
export TSLIB_PLUGINDIR=/tslib1.4/lib/ts
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tslib1.4/lib
export TS_INFO_FILE=/sys/class/input/input2/uevent
1.5、執行和測試
(1)錯誤1:No raw modules loaded.
ts_config: No such file or directory
解決:在etc/ts.conf中開啟module raw input這行的註釋就行了。

執行測試程式發生Segmentation fault

 

2、QT5.6.2配置和交叉編譯

解壓QT5.6.2原始碼

ar -xvf qt-everywhere-opensource-src-5.6.2.tar.gz

cd qt-everywhere-opensource-src-5.6.2

(1)修改qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf


#sgl added
QT_QPA_DEFAULT_PLATFORM = linuxfb
QMAKE_CFLAGS_RELEASE   += -O2  -march=armv7-a   
QMAKE_CXXFLAGS_RELEASE += -O2  -march=armv7-a
# modifications to g++.conf
QMAKE_CC = arm-linux-gcc -lts
QMAKE_CXX = arm-linux-g++ -lts
QMAKE_LINK = arm-linux-g++ -lts
QMAKE_LINK_SHLIB = arm-linux-g++ -lts
# modifications to linux.conf
QMAKE_AR = arm-linux-ar cqs 
QMAKE_OBJCOPY = arm-linux-objcopy 
QMAKE_NM = arm-linux-nm -P
QMAKE_STRIP = arm-linuxi-strip 

 

(2)編譯前配置(可以參考./configure --help的提示來配置) 比較新的QT版本不支援C++98

./configure  -prefix /opt/QT5.6.2  \
  -opensource  \
  -confirm-license \
  -release  \
  -shared  \
  -accessibility \
-c++std c++98 \
  -xplatform linux-arm-gnueabi-g++ \
-qpa linuxfb \
-linuxfb \
-qreal float \
-pch \
-qt-zlib \
  -qt-libjpeg \
          -qt-libpng \
-no-sse2 \
          -no-largefile \
          -no-qml-debug \
          -no-glib \
-no-gtkstyle \
  -no-opengl \
  -nomake tools \
  -nomake examples \
  -tslib \
  -skip qt3d -skip qtcanvas3d -skip qtdoc -skip qtwayland \
  -I /opt/tslib/include \
  -L /opt/tslib/lib