很早以前写的记录,发上来供大家参考一下。有不对的地方欢迎大家指点。
Qt5.3移植到arm开发板过程
Qt creat:
qt-creator-opensource-linux-x86-3.2.0-rc1.run
Qt SDK:
qt-opensource-linux-x86-5.3.0-RC.run
Qt 5.3源码:
qt-everywhere-opensource-src-5.3.0-RC.tar.gz
tslib1.4源码:
tslib-1.4.tar.bz2
libiconv-1.1.4源码:
虚拟机环境:
Ubuntu 12.04.3 LTS \n \l
arm-none-linux-gnueabi-gcc(需手动安装配置):
arm-none-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-none-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/opt/arm-2011.09/bin/../libexec/gcc/arm-none-linux-gnueabi/4.6.1/lto-wrapper
Target: arm-none-linux-gnueabi
Configured with: /scratch/jwlemke/2011.09-arm-linux-eabi-lite/src/gcc-4.6-2011.09/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --enable-extra-sgxxlite-multilibs --with-arch=armv5te --with-gnu-as --with-gnu-ld --with-specs='%{save-temps: -fverbose-asm} %{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables} -D__CS_SOURCERYGXX_MAJ__=2011 -D__CS_SOURCERYGXX_MIN__=9 -D__CS_SOURCERYGXX_REV__=70 %{O2:%{!fno-remove-local-statics: -fremove-local-statics}} %{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: -fremove-local-statics}}}' --enable-languages=c,c++ --enable-shared --enable-lto --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion='Sourcery CodeBench Lite 2011.09-70' --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/scratch/jwlemke/2011.09-arm-linux-eabi-lite/install/arm-none-linux-gnueabi/libc --with-gmp=/scratch/jwlemke/2011.09-arm-linux-eabi-lite/obj/host-libs-2011.09-70-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpfr=/scratch/jwlemke/2011.09-arm-linux-eabi-lite/obj/host-libs-2011.09-70-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpc=/scratch/jwlemke/2011.09-arm-linux-eabi-lite/obj/host-libs-2011.09-70-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-ppl=/scratch/jwlemke/2011.09-arm-linux-eabi-lite/obj/host-libs-2011.09-70-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-cloog=/scratch/jwlemke/2011.09-arm-linux-eabi-lite/obj/host-libs-2011.09-70-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-libelf=/scratch/jwlemke/2011.09-arm-linux-eabi-lite/obj/host-libs-2011.09-70-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --disable-libgomp --enable-poison-system-directories --with-build-time-tools=/scratch/jwlemke/2011.09-arm-linux-eabi-lite/install/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/jwlemke/2011.09-arm-linux-eabi-lite/install/arm-none-linux-gnueabi/bin
Thread model: posix
gcc version 4.6.1 (Sourcery CodeBench Lite 2011.09-70)
pc gcc(默认):
gcc -v
使用内建 specs。
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6/lto-wrapper
目标:i686-linux-gnu
配置为:../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
线程模型:posix
gcc 版本 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
操作尽量进入root权限操作
一. 安装编译环境需要的依赖
apt-get install vim
apt-get install libtool autoconf automake git gawk
如果编译中有一下错误,请安装对应的包。
(1)
The test for linking against libxcb and support libraries failed! You might need to install dependency packages, or pass -qt-xcb. See src/plugins/platforms/xcb/README.
apt-get install libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-sync0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-glx0-dev
(2)
Warning: Disabling Linux Accessibility Bridge: DBus is missing.
apt-get install dbus-*dev
(3)
No package 'libpci' found
apt-get install libnss3-dev libgconf2-dev libgtk2.0-dev libpci-dev libudev-dev libpulse-dev libc6-dev:i386 build-essential gcc-multilib g++-multilib gperf
ERROR sys\capability.h apt-get install libcap
apt-get install texinfo gawk bison flex
(4)
error: alsa/asoundlib.h: 没有那个文件或目录
apt-get install libasound2-dev
(5)
error: cannot find -lcrypto
collect2: error: ld returned 1 exit status
用新立德搜索为安装的包 搜索“libcrypto”
按后标记 libssl-dev libssl1.0.0 以及 1.0.0libssl-deb
(6)
无法输入中文(同上新利德或者直接apt-get install):
fcitx-libs-qt5 fcitx-libs-qt5-dbg fcitx-libs-qt5-dev
二. tslib1.4移植 与 libiconv-1.1.4移植
(1)获取源码:
git clone https://github.com/kergoth/tslib
或者tslib-1.4.tar.bz2 解压;
(2)源码编译:
export CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-g++
./autogen.sh
echo "ac_cv_func_malloc_0_nonnull=yes" > cache-file.cache
./configure --host=arm-none-linux-gnueabi --cache-file=cache-file.cache --prefix=/work/Qt_install/tslib
make
make install
error:
ts_uinput.c: In function ‘send_touch_events’:
ts_uinput.c:206:23: error: ‘ABS_MT_TOOL_X’ undeclared (first use in this function)
ts_uinput.c:206:23: note: each undeclared identifier is reported only once for each function it appears in
ts_uinput.c:212:23: error: ‘ABS_MT_TOOL_Y’ undeclared (first use in this function)
make[2]: *** [ts_uinput.o] 错误 1
make[2]:正在离开目录 `/home/small/work/tslib/tools'
make[1]: *** [all-recursive] 错误 1
make[1]:正在离开目录 `/home/small/work/tslib'
make: *** [all] 错误 2
屏蔽对应的代码段
(3)tslib移植
进入安装目录:/work/Qt_install/tslib
1.修改etc/ts.config
module_raw input
2.将tslib目录拷贝到开发板/usr/local/下
3.开发板环境配置
修改/etc/profile文件
export HOME=/root
export TSLIB_ROOT=/usr/local/tslib
export TSLIB_TSDEVICE=/dev/event1
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/usr/local/tslib/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/local/tslib/lib/ts
export TSLIB_ts_bin=/usr/local/tslib/bin
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_CONSOLEDEVICE=none
export LD_LIBRARY_PATH=$TSLIB_ROOT/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
然后运行/usr/local/tslib/下的校准程序或者测试程序即可。
ts_calibrate ts_harvest ts_print ts_print_raw ts_test
(4)libiconv-1.1.4编译与移植
1.
./configure -prefix=/work/Qt_install/libicon-1.14 -host=arm-none-linux-gnueabi
make
make intsll
2.复制安装目录/work/Qt_install/libicon-1.14/lib/preloadable_libiconv.so文件到开发板/lib目录即可
备注:CC和CXX可以改成自己的编译器比如:CC=arm-linux-gcc CXX=arm-linux-g++
--prefix=/tslib安装目录
--host=arm-linux
错误提示:
(1)
./ts_calibrate
No raw modules loaded.
ts_config: No such file or directory
修改:
tslib安装目录etc/ts.config :
module_raw input
其他不变;
(2)
./ts_calibrate
xres = 480, yres = 272
tslib: Selected device uses a different version of the event protocol than tslib was compiled for
^Csignal 2 caught
修改:
arm-none-linux-gcc-gnueabi中的头文件:
/opt/arm-2011.09/arm-none-linux-gnueabi/libc/usr/include/linux/input.h
修改版本号
//bk 原来的 0x010001改成0x0x0000
//#define EV_VERSION 0x010001
//new tslib version error
#define EV_VERSION 0x010000
/*
或者修改内核中 include/linux/input.h 修改同上。
三.Qt5.3移植
(1)Qt源码解压:
tar -xvf qt-everywhere-opensource-src-5.3.0-RC.tar.gz
(2)配置
1.修改
qtbase/mkspecs/linux-arm-gnueabi-g++目录下的qmake.conf
cd /work/Qt/arm/qtbase/mkspecs/linux-arm-gnueabi-g++
gedit qmake.conf
#
# qmake configuration for building with arm-linux-gnueabi-g++
#
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
//添加的内容
QT_QPA_DEFAULT_PLATFORM = linuxfb
QMAKE_CFLAGS_RELEASE +=-O2 -march=armv5te
QMAKE_CXXFLAGS_RELEASE +=-O2 -march=armv5te
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
//添加的内容
QMAKE_INCDIR += /work/Qt_install/tslib/include
QMAKE_LIBDIR += /work/Qt_install/tslib/lib
# 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)
2.修改文件qtdeclarative/src/src.pro文件的第18行
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS += \
qml
qtHaveModule(gui):contains(QT_CONFIG, opengl(es1|es2)?) {
SUBDIRS += \
quick \
qmltest \
particles
}
SUBDIRS += \
plugins \
imports \
qmldevtools
qtHaveModule(quick):qtHaveModule(widgets): SUBDIRS += quickwidgets
qmldevtools.CONFIG = host_build
3.创建autoconfig.sh
./configure -prefix /work/Qt_install/arm -confirm-license -release -opensource -shared -make libs -xplatform linux-arm-gnueabi-g++ -optimized-qmake -pch -qt-sql-sqlite -qt-libjpeg -qt-zlib -no-opengl -no-sse2 -no-openssl -no-nis -no-cups -no-glib -no-iconv -no-xcursor -no-xfixes -no-xrandr -no-xrender -no-separate-debug-info -nomake examples -nomake tools -no-c++11 -qt-libpng -qt-freetype -qreal float -I/work/Qt_install/tslib/include -L/work/Qt_install/tslib/lib
保存后,chmod a+x autoconfig.sh
./autoconfig.sh 运行
也可直接使用不写入autoconfig.sh
中间提示:
Type 'c' if you want to use the Commercial Edition.
Type 'o' if you want to use the Open Source Edition.
输入 “o”
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”
make: g++:命令未找到
make: *** [project.o] 错误 127
方法:sudo apt-get install g++
(4) Qt编译与移植
1.编译
make
make install
1.1 编译自带的Qtslib
qtbase/src/plugins/generic/tslib
执行qmake
/work/Qt_install/arm/bin/qmake
察看下Makefile
CC = arm-none-linux-gnueabi-gcc
CXX = arm-none-linux-gnueabi-g++
LINK = arm-none-linux-gnueabi-g++
AR = arm-none-linux-gnueabi-ar cqs
QMAKE = /work/Qt_install/arm/bin/qmake-arm
STRIP = arm-none-linux-gnueabi-strip
make
make install
注释:
打印问题:
//qDebug() << "QTsLibMouseHandler" << key << specification;
注释掉qtbase/src/plugins/generic/tslib/qtslib.cpp 62行;
2.移植到arm开发板
如果编译没有出错,进行一下操作:
安装后的arm目录:/work/Qt_install/arm/中的文件
复制到开发板:/usr/local/Qt-5.3
3.修改开发板环境变量:
/etc/profile
export QTDIR=/usr/local/Qt-5.3
export LD_LIBRARY_PATH=/usr/local/Qt-5.3/lib:$LD_LIBRARY_PATH:/lib
export POINTERCAL_FILE=/etc/pointercal
export QT_QPA_FONTDIR=/usr/local/Qt-5.3/lib/fonts
export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/local/Qt-5.3/plugins
export QT_QPA_EGLFS_FB=/dev/fb0
export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0,size=480x272,tty=/dev/tty0
export QT_QPA_GENERIC_PLUGINS=tslib:/dev/event1
export LD_PRELOAD=/lib/preloadable_libiconv.so:/usr/local/Qt-5.3/plugins/generic/libqtslibplugin.so:/usr/local/Qt-5.3/plugins/generic/libqevdevtouchplugin.so:/usr/local/Qt-5.3/plugins/generic/libqevdevmouseplugin.so:/lib/libts.so
export PATH=$QTDIR/bin:$PATH
移植tslib以及Qt以后/etc/profile文件配置如下:
echo "Welcome to Linux"
export QTDIR=/usr/local/Qt-5.3
export LD_LIBRARY_PATH=/usr/local/Qt-5.3/lib:$LD_LIBRARY_PATH:/lib
export POINTERCAL_FILE=/etc/pointercal
export QT_QPA_FONTDIR=/usr/local/Qt-5.3/lib/fonts
export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/local/Qt-5.3/plugins
export QT_QPA_EGLFS_FB=/dev/fb0
export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0,size=480x272,tty=/dev/tty0
export QT_QPA_GENERIC_PLUGINS=tslib:/dev/event1
export LD_PRELOAD=/lib/preloadable_libiconv.so:/usr/local/Qt-5.3/plugins/generic/libqtslibplugin.so:/usr/local/Qt-5.3/plugins/generic/libqevdevtouchplugin.so:/usr/local/Qt-5.3/plugins/generic/libqevdevmouseplugin.so:/lib/libts.so
export PATH=$QTDIR/bin:$PATH
export HOME=/root
export TSLIB_ROOT=/usr/local/tslib
export TSLIB_TSDEVICE=/dev/event1
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/usr/local/tslib/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/local/tslib/lib/ts
export TSLIB_ts_bin=/usr/local/tslib/bin
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_CONSOLEDEVICE=none
export LD_LIBRARY_PATH=$TSLIB_ROOT/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
(5)Qt creat 以及Qt SD安装
1.Qt creat在终端中运行
sudo qt-creator-opensource-linux-x86-3.3.0-rc1.run
2.Qt SDK
sudo qt-opensource-linux-x86-5.3.0-RC.run
3.配置
打开Qt---》工具---》 选项---》构建和运行
(1)编译器
找不到的话 手动添加自己的安装路径,pc gcc和arm-linux-gcc
(2)Qt Version
手动添加安装的Qt SDK和自己编译出来的arm版本
(3)构建套件
手动添加arm-linux 设备类型:桌面 编译器选 arm-linux-gcc
Qt版本选Qt5.3(arm)
(4)文本编辑器
显示---》开启文字折行
行为---》编码utf-8
完。
Smaller
2016-03-09 10:55
参考文档:
http://blog.csdn.net/woshidahuaidan2011/article/details/43604059