1. 程式人生 > >qt5.5.1在Cortex-a8上移植記錄

qt5.5.1在Cortex-a8上移植記錄

使用Qt5.5.1原始碼包進行編譯:下載地址 http://download.qt.io/official_releases/qt/

tslib1.4編譯

1.解壓並進入Tslib目錄
2.gedit tests/ts_calibrate.c    230行在open的引數傳入增加一個引數,0777
    if ((calfile = getenv("TSLIB_CALIBFILE")) != NULL)
    {
        cal_fd = open (calfile, O_CREAT | O_RDWR,0777);
    }
    else
    {
        cal_fd = open ("/etc/pointercal", O_CREAT | O_RDWR,0777);
    }

3.拷貝安裝指令碼並執行 installTslib.sh

#!/bin/sh
./autogen.sh 
make clean && make distclean
echo "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cache
CC=arm-fsl-linux-gnueabi-gcc
./configure --host=arm-fsl-linux-gnueabi --prefix=/usr/local/arm/tslib1.4 --cache-file=arm-linux.cache
make && make install


Qt編譯

1、進入原始碼包根目錄,配置qtbase/mkspecs/linux-arm-gnueabi-g++/

qmake.conf

  1 #
  2 # qmake configuration for building with arm-linux-gnueabi-g++
  3 #
  4 
  5 MAKEFILE_GENERATOR      = UNIX
  6 CONFIG                 += incremental
  7 QMAKE_INCREMENTAL_STYLE = sublib
  8 
  9 QT_QPA_DEFAULT_PLATFORM = linuxfb
 10 QMAKE_CFLAGS_RELEASE   += -O2 -march=armv7-a
 11 QMAKE_CXXFLAGS_RELEASE += -O2 -march=armv7-a  #cortex-a8
 12 
 13 include(../common/linux.conf)
 14 include(../common/gcc-base-unix.conf)
 15 include(../common/g++-unix.conf)
 16 
 17 # modifications to g++.conf
 18 QMAKE_CC                = /usr/local/arm/arm-linux-gcc-4.8.3/bin/arm-none-linux-gnueabi-gcc
 19 QMAKE_CXX               = /usr/local/arm/arm-linux-gcc-4.8.3/bin/arm-none-linux-gnueabi-g++
 20 QMAKE_LINK              = /usr/local/arm/arm-linux-gcc-4.8.3/bin/arm-none-linux-gnueabi-g++
 21 QMAKE_LINK_SHLIB        = /usr/local/arm/arm-linux-gcc-4.8.3/bin/arm-none-linux-gnueabi-g++
 22 
 23 # modifications to linux.c/usr/local/arm/arm-linux-gcc-4.8.3/bin/arm-none-linux-gnueabi
 24 QMAKE_AR                = /usr/local/arm/arm-linux-gcc-4.8.3/bin/arm-none-linux-gnueabi-ar cqs
 25 QMAKE_OBJCOPY           = /usr/local/arm/arm-linux-gcc-4.8.3/bin/arm-none-linux-gnueabi-objcopy
 26 QMAKE_NM                = /usr/local/arm/arm-linux-gcc-4.8.3/bin/arm-none-linux-gnueabi-nm -P
 27 QMAKE_STRIP             = /usr/local/arm/arm-linux-gcc-4.8.3/bin/arm-none-linux-gnueabi-strip
 28 load(qt_config)

2、配置編譯選項

./configure -release -opensource -xplatform linux-arm-gnueabi-g++ -prefix /usr/local/qt -no-c++11 -no-opengl -no-dbus -no-icu -no-eglfs -no-iconv -I/usr/local/tslib/include -L/usr/local/tslib/lib

配置成功顯示內容

This is the Qt Open Source Edition.

You are licensed to use this software under the terms of
the Lesser GNU General Public License (LGPL) versions 2.1.
You are also licensed to use this software under the terms of
the GNU Lesser General Public License (LGPL) versions 3.

Type '3' to view the GNU Lesser General Public License version 3.
Type 'L' to view the Lesser GNU General Public License version 2.1.
Type 'yes' to accept this license offer.
Type 'no' to decline this license offer.

Do you accept the terms of either license? yes

Creating qmake...
.Done.
Running configuration tests...
Warning: Disabling pkg-config since PKG_CONFIG_LIBDIR is not set.
Warning: Disabling pkg-config since PKG_CONFIG_SYSROOT_DIR is not set.

   Configure summary

Building on:   linux-g++ (x86_64, CPU features: mmx sse sse2)
Building for:  linux-arm-gnueabi-g++ (arm, CPU features: none detected)
Platform notes:

            - Also available for Linux: linux-kcc linux-icc linux-cxx
        
Build options:
  Configuration .......... accessibility audio-backend clock-gettime clock-monotonic compile_examples concurrent cross_compile dbus enable_new_dtags evdev eventfd freetype full-config getaddrinfo getifaddrs harfbuzz iconv inotify ipv6ifname large-config largefile linuxfb medium-config minimal-config mremap nis no-pkg-config pcre png posix_fallocate precompile_header qpa qpa reduce_exports release rpath shared small-config zlib
  Build parts ............ libs examples
  Mode ................... release
  Using sanitizer(s)...... none
  Using C++11 ............ no
  Using gold linker....... no
  Using new DTAGS ........ yes
  Using PCH .............. yes
  Target compiler supports:
    Neon ................. no

Qt modules and options:
  Qt D-Bus ............... yes (loading dbus-1 at runtime)
  Qt Concurrent .......... yes
  Qt GUI ................. yes
  Qt Widgets ............. yes
  Large File ............. yes
  QML debugging .......... yes
  Use system proxies ..... no

Support enabled for:
  Accessibility .......... yes
  ALSA ................... no
  CUPS ................... no
  Evdev .................. yes
  FontConfig ............. no
  FreeType ............... yes (bundled copy)
  Glib ................... no
  GStreamer .............. no
  GTK theme .............. no
  HarfBuzz ............... yes (bundled copy)
  Iconv .................. yes
  ICU .................... no
  Image formats:
    GIF .................. yes (plugin, using bundled copy)
    JPEG ................. yes (plugin, using bundled copy)
    PNG .................. yes (in QtGui, using bundled copy)
  journald ............... no
  libinput................ no
  mtdev .................. no
  Networking:
    getaddrinfo .......... yes
    getifaddrs ........... yes
    IPv6 ifname .......... yes
    libproxy.............. no
    OpenSSL .............. no
  NIS .................... yes
  OpenGL / OpenVG:
    EGL .................. no
    OpenGL ............... no
    OpenVG ............... no
  PCRE ................... yes (bundled copy)
  pkg-config ............. no
  PulseAudio ............. no
  QPA backends:
    DirectFB ............. no
    EGLFS ................ no
      EGLFS i.MX6....... .
      EGLFS KMS .......... no
      EGLFS Mali .........
      EGLFS Raspberry Pi .
      EGLFS X11 .......... no
    LinuxFB .............. yes
    XCB .................. no
  Session management ..... yes
  SQL drivers:
    DB2 .................. no
    InterBase ............ no
    MySQL ................ no
    OCI .................. no
    ODBC ................. no
    PostgreSQL ........... no
    SQLite 2 ............. no
    SQLite ............... yes (plugin, using bundled copy)
    TDS .................. no
  tslib .................. no
  udev ................... no
  xkbcommon-x11........... no
  xkbcommon-evdev......... no
  zlib ................... yes (bundled copy)

Info: creating super cache file /home/djq/Downloads/qt-everywhere-opensource-src-5.5.0/.qmake.super

Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into /usr/local/qt

Prior to reconfiguration, make sure you remove any leftovers from
the previous build.

3、sudo make -j4 & sudo make install


問題1:make[1]: *** [sub-src-make_first] 錯誤 2

方案1:
主要原因是它依賴的dbus目錄沒有編譯,解決方法如下:
#cd /home/hello/qt-everywhere-opensource-src-5.4.0/qtbase/src/dbus執行下面的
如沒有Makefile,執行下面的命令
#../../bin/qmake dbus.pro
然後執行Make.
#make
編譯成功後,再切換到/home/hello/qt-everywhere-opensource-src-5.4.0目錄下,執行
#make

方案2:-no-dbus   (注:當前使用方案)


問題2:make報錯module-qt3d-install_subtargets 錯誤(參考http://my.oschina.net/u/1177171?disp=2&catalog=0&sort=time&p=1大嬸的部落格,灰常感謝)
方案1:在編譯之前,還有個改動,額。。。qt3d和qtcanvas3d在編譯的時候會報錯,說是未識別模組,而且嵌入式的沒有opengl,識別了也會報錯,導致編譯失敗,而且編譯配置引數裡面也沒有這兩個模組的配置。我的解決方法簡單粗暴,在配置時引數加-no-opengl,然後開啟qt-everywhere-opensource-src-5.5.0/qt.pro檔案,找到:

addModule(qt3d, qtdeclarative qtimageformats)
addModule(qtcanvas3d, qtdeclarative)

這兩行註釋掉(#號註釋),或者直接刪掉。如果不註釋掉,即使加了-no-opengl也會報錯,編譯失敗。



問題3:
make[3]: arm-none-linux-gnueabi-g++:命令未找到
make[3]: *** [.pch/Qt5WebChannel.gch/c++] 錯誤 127
make[3]:正在離開目錄 `/home/djq/Downloads/qt-everywhere-opensource-src-5.5.0/qtwebchannel/src/webchannel'
make[2]: *** [sub-webchannel-install_subtargets] 錯誤 2
make[2]:正在離開目錄 `/home/djq/Downloads/qt-everywhere-opensource-src-5.5.0/qtwebchannel/src'
make[1]: *** [sub-src-install_subtargets] 錯誤 2
make[1]:正在離開目錄 `/home/djq/Downloads/qt-everywhere-opensource-src-5.5.0/qtwebchannel'
make: *** [module-qtwebchannel-install_subtargets] 錯誤 2

方案1:修改qmake.conf檔案的交叉編譯工具位置,設定為絕對路徑錯誤消除。




4、板卡/etc/profile設定,使用Evdevtouch
echo "Compile usr app (gcc version 4.8.3),Support Qt version 5.5.1"
# config qts env parm                                          
export QTDIR=/usr/local/qt                                         
export QPEDIR=$QTDIR                                               
export QT_QWS_FONTDIR=$QTDIR/lib/fonts                             
                                                                   
export QWS_SIZE=1366x768                                           
#export QWS_DISPLAY=LinuxFb:/dev/fb0                               
export PATH=$QTDIR/bin:$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH                 
export QT_QPA_PLATFORM_PLUGIN_PATH=$QTDIR/plugins                        
export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0                               
export QT_QPA_GENERIC_PLUGINS=EvdevTouch:/dev/input/event1               
#export QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=/dev/input/event1:rotate=180  #可以使觸控式螢幕旋轉一定角度90-180-270




5、泰奇克電容觸控式螢幕驅動配置檔案/etc/eGTouchL.ini
Direction                       3//[1] Invert X   , [2] Invert Y   , [4] Swap X wit   xy各自映象