使用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各自镜像
Logo

更多推荐