Mipsel 平臺下 編譯QT 5.9

1,交叉編譯器信息:

mipsel-linux-gcc -v
使用內建 specs。
COLLECT_GCC=/mips/host/usr/bin/mipsel-linux-gcc.br_real
COLLECT_LTO_WRAPPER=/mips/host/usr/libexec/gcc/mipsel-buildroot-linux-gnu/4.9.3/lto-wrapper
目標:mipsel-buildroot-linux-gnu
配置爲:./configure --prefix=/mips/host/usr --sysconfdir=/mips/host/etc --enable-static --target=mipsel-buildroot-linux-gnu --with-sysroot=/mips/host/usr/mipsel-buildroot-linux-gnu/sysroot --disable-__cxa_atexit --with-gnu-ld --disable-libssp --disable-multilib --with-gmp=/mips/host/usr --with-mpfr=/mips/host/usr --with-pkgversion='Buildroot 2016.02' --with-bugurl=http://bugs.buildroot.net/ --disable-libquadmath --enable-tls --enable-plugins --enable-lto --disable-libmudflap --enable-threads --with-mpc=/opt/mips/Gm9260/host/usr --with-isl=/mips/host/usr --with-cloog=/mips/host/usr --with-float=soft --disable-decimal-float --with-arch=mips32 --with-abi=32 --enable-languages=c,c++ --with-build-time-tools=/mips/host/usr/mipsel-buildroot-linux-gnu/bin --enable-shared --enable-libgomp
線程模型:posix
gcc 版本 4.9.3 (Buildroot 2016.02) 

2,相關庫:

     1)qt-everywhere-opensource-src-5.9.9.tar.xz

     2)libts庫:https://github.com/libts/tslib  

cd tslib
./autogen.sh
./configure --host=mipsel-linux --prefix=/opt/mips_qt_project/tslib
make
make install

3,qt編譯

     1)tar -xvf qt-everywhere-opensource-src-5.9.9.tar.xz

     2)cd qt-everywhere-opensource-src-5.9.9

     3)vi qtbase/mkspecs/devices/linux-mipsel-ci20-g++/qmake.conf 

#
# qmake configuration for building with mips-mti-linux-gnu-g++
# build for CI20 targets X11
#

CROSS_COMPILE           = mipsel-linux-   #此處修改成實際使用的交叉編譯器

include(../common/linux_device_pre.conf)

QMAKE_CFLAGS            = -EL -march=mips32r2 -lts #此處增加 -lts 鏈接tslib庫
QMAKE_CXXFLAGS          = $${QMAKE_CFLAGS}
QMAKE_LFLAGS            = -EL

QT_QPA_DEFAULT_PLATFORM = linuxfb   #xcb  本人編譯後插件沒有xcb,所以修改默認平臺爲linuxfb

QMAKE_LIBS_EGL          = -lEGL -lIMGegl -lusc
QMAKE_LIBS_OPENGL_ES2   = -lGLESv2 $${QMAKE_LIBS_EGL}

include(../common/linux_device_post.conf)

load(qt_config)

  4)qt編譯選項

./configure -prefix /opt/mips_qt_project/qt5 \
            -opensource -release -shared -pch \
            -sql-sqlite -qt-libjpeg -qt-zlib \
            -qt-libpng -qt-freetype -no-openssl \
            -nomake examples -nomake tests \
            -nomake tools -optimized-qmake \
            -no-opengl -no-cups -no-xkb -no-sm \
            -no-separate-debug-info \
            -xplatform devices/linux-mipsel-ci20-g++ \
            -linuxfb -confirm-license \
            -tslib -I/opt/mips_qt_project/tslib/include -L/opt/mips_qt_project/tslib/lib

4,執行./configure 時的錯誤

Note: No wayland-egl support detected. Cross-toolkit compatibility disabled.
...
ERROR: Feature 'tslib' was enabled, but the pre-condition 'libs.tslib' failed
 

提示tslib有錯誤可能的原因:

1)檢查編譯選項的 -I/opt/mips_qt_project/tslib/include -L/opt/mips_qt_project/tslib/lib 是否有對應的庫和頭文件

2)tslib庫編譯有問題,需要重新編譯tslib;(本人初始使用tslib1.4編譯時,提示錯誤,通過修改tslib源碼後編譯通過,但是編譯出來的tslib庫不正確,重新從github下載後,未修改編譯通過,這個tslib正確)

3)重新編譯後仍提示這個問題,刪除qt源碼的目錄,重新解壓出來

 

6,環境變量

#tslib環境變量
export TSLIB_ROOT=/usr/local/tslib   #tslib 編譯出來的文件,全部拷貝到此目錄 /usr/local/tslib
export TSLIB_CONSOLEDEVICE=none    
export TSLIB_FBDEVICE=/dev/fb0 
export TSLIB_TSDEVICE=/dev/input/event0 
export TSLIB_CALIBFILE=/etc/pointercal 
export TSLIB_CONFFILE=/usr/local/tslib/etc/ts.conf 
export TSLIB_PLUGINDIR=/usr/local/tslib/lib/ts 
export TSLIB_TSEVENTTYPE=INPUT 
#QT的環境變量
export QTDIR=/usr/local/qt5  
export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/local/qt5/plugins #qt5編譯出來的plugins 
export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
export QT_QPA_FONTDIR=$QTDIR/lib/fonts
export TSDEVICE=/dev/input/event0   #此處是實際的觸摸屏設備
export QT_QPA_GENERIC_PLUGINS=tslib:$TSDEVICE  # tstlib:/dev/input/event0表示使用的插件是 tslib
export QWS_MOUSE_PROTO=tslib:$TSDEVICE
export set QWS_DISPLAY=Linuxfb:/dev/fb0
export set QWS_DISPLAY="LinuxFb:mmWidth100:mmHeight130:0"
export set QT_QWS_FONTDIR=$QTDIR/lib/fonts/  #放編碼文件,不然中文亂碼

export LD_PRELOAD=/usr/lib/preloadable_libiconv.so #若提示下面內容,則需要此庫
#QIconvCodec::convertToUnicode: using Latin-1 for conversion, iconv_open failed
#QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv_open failed

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章