tslib1.4移植,Qt4.8.7移植arm,qt5.7.0移植arm

先安装工具:

sudo apt-get install autoconf
sudo apt-get install automake
sudo apt-get install libtool

解压tslib-1.4.tar.gz库并进入tslib:

tar -zvxf tslib-1.4.tar.gz 

cd tslib

运行autogen.sh

./autogen.sh
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./config.guess'
libtoolize: copying file `./config.sub'
libtoolize: copying file `./install-sh'
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in `m4/internal'.
libtoolize: copying file `m4/internal/libtool.m4'
libtoolize: copying file `m4/internal/ltoptions.m4'
libtoolize: copying file `m4/internal/ltsugar.m4'
libtoolize: copying file `m4/internal/ltversion.m4'
libtoolize: copying file `m4/internal/lt~obsolete.m4'
libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configu           re.ac and
libtoolize: rerunning libtoolize, to keep the correct libtool macr           os in-tree.
configure.ac:7: installing `./missing'
plugins/Makefile.am: installing `./depcomp'
 

查看当前使用的编译器:使用的是arm4.3.2

echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/ndk/android-ndk-r8b:/usr/local/arm/4.3.2/bin

./configure CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-g++ --host=arm-none-linux-gnueabi --prefix=/opt/tslib1.4 ac_cv_func_malloc_0_nonnull=yes

上面的配置是在同一行的

./configure 输出
configure: WARNING: if you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-none-linux-gnueabi-strip... arm-none-linux-gnueabi-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
....

checking whether collie module is requested... yes
checking whether h3600 module is requested... yes
checking whether mk712 module is requested... yes
checking whether arctic2 module is requested... yes
checking whether input module is requested... yes
checking where to place modules... ${libdir}/ts/
checking whether to enable debugging... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating etc/Makefile
config.status: creating plugins/Makefile
config.status: creating src/Makefile
config.status: creating tests/Makefile
config.status: creating tslib-0.0.pc
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands


开始make,make install 到/opt/tslib1.4

make 

make install

root@ubuntu:/opt/tslib1.4# ls
bin  etc  include  lib

vim /opt/tslib1.4/etc/ts.conf 修改第二行,取消注释 

使用arm4.4.3编译器编译tslib

 ./autogen.sh

./configure CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-g++ --host=arm-none-linux-gnueabi --prefix=/opt/tslib1.4 ac_cv_func_malloc_0_nonnull=yes

出错
checking whether the C++ compiler works... no
configure: error: in `/itop_imx6/tslib':
configure: error: C++ compiler cannot create executables
查看cat config.log发现
/usr/local/arm/4.4.3/bin/../libexec/gcc/arm-none-linux-gnueabi/4.4.3/cc1plus: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
写一个测试程序hello.c

arm-none-linux-gnueabi-gcc -o hello hello.c
/usr/local/arm/4.4.3/bin/../libexec/gcc/arm-none-linux-gnueabi/4.4.3/cc1: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
搜索相应的错误要安装

sudo apt-get install lib32z1 lib32ncurses5
sudo apt-get install lib32stdc++6

安装不了换下载站点

System Settings→System→Software & updates→Ubuntu Software→Download from 选择站点→选择清华站点

再次安装成功。

再次./configure成功

再次arm-none-linux-gnueabi-gcc -o hello hello.c成功

make 

sudo make install

下面就是编译qt4.8.7,因为4.8.7要使用arm4.4.3编译,所有先用该编译器tslib.

移植qt-everywhere-opensource-src-4.8.7 到arm平台

使用的编译器是arm-linux-gcc-4.4.3 

先创建一个build_all.sh脚本文件,内容如下,运行完之后,如果成功编译好的会放在/opt/qt-4.8.7_arm目录下。

chmod 777 build_all.sh

./build_all.sh

#/bin/bash

export PATH=/usr/local/arm/4.4.3/bin:$PATH
export PKG_CONFIG_PREFIX=$TOOLCHAIN/arm-none-linux-gnueabi
export TB_CC_PREFIX=arm-linux-
export TOOLCHAIN=/usr/local/arm/4.4.3


rm -fr qt-everywhere-opensource-src-4.8.7
rm -fr /opt/qt-4.8.7

tar xfvz qt-everywhere-opensource-src-4.8.7.tar.gz

cd qt-everywhere-opensource-src-4.8.7

echo yes | ./configure -opensource -embedded arm -xplatform qws/linux-arm-g++  -no-webkit -qt-libtiff -qt-libmng  -qt-mouse-tslib -qt-mouse-pc -qt-gfx-transformed -no-mouse-linuxtp -prefix /opt/qt-4.8.7_arm -I /opt/tslib1.4/include -L /opt/tslib1.4/lib


make 2>&1 | tee ../qte4.8.7Makelog && make install

编译配置帮助使用

./configure --help

 -opensource 自由版本(免费的)

-embedded arm 嵌入式 arm 架构

-xplatform qws/linux-arm-g++ 交叉编译的目标平台

-no-webkit 去掉 webkit 插件

-qt-libtiff 支持 tiff 插件

-qt-libmng 支持 mng 插件

-qt-mouse-tslib,-qt-mouse-pc,-no-mouse-linuxtp 触摸相关

-I ... Add an explicit include path,添加路径,这里包含了 “/usr/local/tslib/include”

-L Add an explicit library path 添加库路径,这里包含了“/usr/local/tslib/lib” 其它常用参数,

例如“-verbose”可以打印每一步的信息,编译查找编译过程中的问 题;“-static”可以将库文件编译成静态,通过静态库移植的应用,不用将 QtE 库下载到开 发板上。 还有上面的“/usr/local/tslib”则是移植的触摸库文件。

下面介绍Qt5.7.0的移植

首先先准备的原料:

tslib-1.4.tar.gz,/work目录

arm-2014.05-29-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2,/usr/local/arm目录

qt-everywhere-opensource-src-5.7.0.tar.gz,/work/qt-everywhere-opensource-src-5.7.0目录

先解压arm编译器设置环境变量使用arm-2014.05-29编译器,export PATH=/usr/local/arm/arm-2014.05/bin;$PATH

开始编译tslib1.4,解压执行

cd tslib
./autogen.sh
./configure CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-g++ --host=arm-none-linux-gnueabi --prefix=/opt/tslib1.4 ac_cv_func_malloc_0_nonnull=yes
make
make install

vim /opt/tslib1.4/etc/ts.conf修改第二行取消注释
module_raw input

开始编译qt5.7.0,解压修改 qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf文件

# 
#qmake configuration for building with arm-linux-gnueabi-g++
#
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib

QT_QPA_DEFAULT_PLATFORM = linux #eglfs
QMAKE_CFLAGS_RELEASE += -O2 -march=armv7-a
QMAKE_CXXFLAGS_RELEASE += -O2 -march=armv7-a

include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)

# modifications to g++.conf
QMAKE_CC = arm-none-linux-gnueabi-gcc
QMAKE_CXX = arm-none-linux-gnueabi-g++
QMAKE_LINK = arm-none-linux-gnueabi-g++
QMAKE_LINK_SHLIB = arm-none-linux-gnueabi-g++

# modifications to linux.conf
QMAKE_AR = arm-none-linux-gnueabi-ar cqs
QMAKE_OBJCOPY = arm-none-linux-gnueabi-objcopy
QMAKE_NM = arm-none-linux-gnueabi-nm -P
QMAKE_STRIP = arm-none-linux-gnueabi-strip

load(qt_config)

创建一个qt的配置脚本文件autoconfigure.sh,修改权限chmod 777 autoconfigure.sh
执行./autoconfigure.sh,需要输入yes

#!/bin/sh
./configure \
-v \
-prefix /opt/qt5.7.0 \
-release \
-opensource \
-make libs \
-xplatform linux-arm-gnueabi-g++ \
-optimized-qmake \
-pch \
-qt-sql-sqlite \
-qt-libjpeg \
-qt-zlib \
-no-opengl \
-skip qt3d \
-skip qtcanvas3d \
-skip qtpurchasing \
-no-sse2 \
-no-openssl \
-no-nis \
-no-cups \
-no-glib \
-no-iconv \
-nomake examples \
-nomake tools \
-skip qtvirtualkeyboard \
-I/opt/tslib1.4/include \
-L/opt/tslib1.4/lib
exit

开始编译,将被安装到/opt/qt5.7.0目录下.

make

make install 

 安装Ubuntu下的Qt4.7.1

./configure -prefix /opt/qt-4.7.1_pc
Which edition of Qt do you want to use ?

Type 'c' if you want to use the Commercial Edition.
Type 'o' if you want to use the Open Source Edition.

输入 o


This is the Qt for Linux/X11 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 General Public License (GPL) versions 3.

Type '3' to view the GNU 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
 

在./configure过程中如果出现了下面的错误,可以执行apt-get install libxtst-dev,之后在执行./configure.

 Basic XLib functionality test failed!
 You might need to modify the include and library search paths by editing
 QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in /work/qt-4.7.1/qt-everywhere-opensource-src-4.7.1/qt-everywhere-opensource-src-4.7.1/mkspecs/linux-g++-64.

如果出现下面的就可以make,make install了

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

To reconfigure, run 'make confclean' and 'configure'.

 make

make install

将安装在/opt/qt-4.7.1_pc目录下

 qt creator 添加编译 ARM 架构程序

打开qtcreator,tools,options ,添加arm gcc编译器,编译器要选择编译qt4.7.1时的编译器一样。如下图操作:

tslib1.4移植,Qt4.8.7移植arm,qt5.7.0移植arm_第1张图片

 添加Qt的版本:

tslib1.4移植,Qt4.8.7移植arm,qt5.7.0移植arm_第2张图片

添加开发套件

tslib1.4移植,Qt4.8.7移植arm,qt5.7.0移植arm_第3张图片

 qt应用程序添加中文显示:

tslib1.4移植,Qt4.8.7移植arm,qt5.7.0移植arm_第4张图片 

你可能感兴趣的:(Qt)