前阶段没少编译QT和QTembedded,这是我的工作文档中的部分。

This is the Qt for Embedded Linux Open Source Edition.

Usage: configure [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir <dir>]

[-docdir <dir>] [-headerdir <dir>] [-plugindir <dir> ] [-datadir <dir>] [-translationdir <dir>] [-sysconfdir <dir>] [-examplesdir <dir>] [-demosdir <dir>] [-buildkey <key>] [-release] [-debug] [-debug-and-release] [-shared] [-static] [-no-fast] [-fast] [-no-largefile] [-largefile] [-no-exceptions] [-exceptions] [-no-accessibility] [-accessibility] [-no-stl] [-stl] [-no-sql-<driver>] [-sql-<driver>] [-plugin-sql-<driver>] [-system-sqlite] [-no-qt3support] [-qt3support] [-platform] [-D <string>] [-I <string>] [-L <string>] [-help] [-qt-zlib] [-system-zlib] [-no-gif] [-qt-gif] [-no-libtiff] [-system-libtiff] [-no-libpng] [-qt-libpng] [-system-libpng] [-no-libmng] [-qt-libmng] [-system-libmng] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg] [-make <part>] [-no-make <part>] [-R <string>] [-l <string>] [-no-rpath] [-rpath] [-continue] [-verbose] [-v] [-silent] [-no-nis] [-nis] [-no-cups] [-cups] [-no-iconv] [-iconv] [-no-pch] [-pch] [-no-dbus] [-dbus] [-dbus-linked] [-no-separate-debug-info] [-no-mmx] [-no-3dnow] [-no-sse] [-no-sse2] [-qtnamespace <namespace>] [-separate-debug-info] [-armfpa] [-no-optimized-qmake] [-optimized-qmake] [-no-xmlpatterns] [-xmlpatterns] [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend] [-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit] [-no-scripttools] [-scripttools] [additional platform specific options (see below)]

Installation options:

These are optional, but you may specify install directories.
-prefix <dir> ...... This will install everything relative to <dir>

(default /usr/local/Trolltech/QtEmbedded-4.5.0)
-hostprefix [dir] .. Tools and libraries needed when developing
applications are installed in [dir]. If [dir] is not given, the current build directory will be used.
-prefix-install .... Force a sandboxed "local" installation of
Qt. This will install into /usr/local/Trolltech/QtEmbedded-4.5.0, if this option is disabled then some platforms will attempt a "system" install by placing default values to be placed in a system location other than PREFIX.
You may use these to separate different parts of the install:
-bindir <dir> ......... Executables will be installed to <dir>

(default PREFIX/bin)
-libdir <dir> ......... Libraries will be installed to <dir>

(default PREFIX/lib)
-docdir <dir> ......... Documentation will be installed to <dir>

(default PREFIX/doc)
-headerdir <dir> ...... Headers will be installed to <dir>

(default PREFIX/include)
-plugindir <dir> ...... Plugins will be installed to <dir>

(default PREFIX/plugins)
-datadir <dir> ........ Data used by Qt programs will be installed to <dir>

(default PREFIX)
-translationdir <dir> . Translations of Qt programs will be installed to <dir>

(default PREFIX/translations)
-sysconfdir <dir> ..... Settings used by Qt programs will be looked for in <dir>

(default PREFIX/etc/settings)
-examplesdir <dir> .... Examples will be installed to <dir>

(default PREFIX/examples)
-demosdir <dir> ....... Demos will be installed to <dir>

(default PREFIX/demos)
You may use these options to turn on strict plugin loading.
-buildkey <key> .... Build the Qt library and plugins using the specified

<key>. When the library loads plugins, it will only load those that have a matching key.

Configure options:

The defaults * are usually acceptable. A plus (+) denotes a default value that needs to be evaluated. If the evaluation succeeds, the feature is included. Here is a short explanation of each option:
#加*号的选项通常是默认安装的,加+号的选项则需要预先评估,评估成功后才可安装。
-release ........... Compile and link Qt with debugging turned off.
#编译链接时不允许使用debug,编译好的qt-embedded不能用于调试程序。
-debug ............. Compile and link Qt with debugging turned on.
#编译链接时允许使用debug,编译好的qt-embedded只能用于调试程序。
-debug-and-release ... Compile and link two versions of Qt, with and without
debugging turned on (Mac only).
-shared ............ Create and use shared Qt libraries.
#创建动态链接库
-static ............ Create and use static Qt libraries.
#创建静态链接库
-no-fast ........... Configure Qt normally by generating Makefiles for all
project files.
#正常速度编译Qt
-fast .............. Configure Qt quickly by generating Makefiles only for
library and subdirectory targets. All other Makefiles are created as wrappers, which will in turn run qmake.
#快速编译Qt,只为库和子目录目标生成Makefile。所有其它的Makefile被打包创建,依次进行qmake。
-no-largefile ...... Disables large file support.
#关闭大文件支持
+ -largefile ......... Enables Qt to access files larger than 4 GB.
#大文件(大于4G)支持
-no-exceptions ..... Disable exceptions on compilers that support it.
#关闭异常支持
-exceptions ........ Enable exceptions on compilers that support it.
#异常支持
-no-accessibility .. Do not compile Accessibility support.
#关闭对windows active控件支持
-accessibility ..... Compile Accessibility support.
#windows active控件支持
-no-stl ............ Do not compile STL support.
#关闭c++标准库支持
-stl ............... Compile STL support.
#c++标准库支持
-no-sql-<driver> ... Disable SQL <driver> entirely.

#完全禁止SQL<driver>

-qt-sql-<driver> ... Enable a SQL <driver> in the QtSql library, by default

none are turned on.
#开启QtSql库中SQL<driver>支持,默认无<driver>开启。

-plugin-sql-<driver> Enable SQL <driver> as a plugin to be linked to

at run time.
Possible values for <driver>: [ db2 ibase mysql oci odbc psql sqlite sqlite2 tds ]

#开启SQL<driver>支持,编译为运行时链接的插件库。

-system-sqlite ..... Use sqlite from the operating system.
#使用操作系统自带的sqlite
-no-qt3support ..... Disables the Qt 3 support functionality.
#关闭Qt3程序支持
-qt3support ........ Enables the Qt 3 support functionality.
#Qt3程序支持
-no-xmlpatterns .... Do not build the QtXml Patterns module.

#不编译QtXml模式模块

+ -xmlpatterns ....... Build the QtXml Patterns module.

QtXml Patterns is built if a decent C++ compiler is used and exceptions are enabled.

#编译QtXml模式模块,前提是使用标准C++编译器和开启了异常支持。

-no-phonon ......... Do not build the Phonon module.
#不编译phonon模块
+ -phonon ............ Build the Phonon module.
Phonon is built if a decent C++ compiler is used.
#编译phonon模块,前提是使用标准c++编译器。
-no-phonon-backend.. Do not build the platform phonon plugin.
#不编译平台phonon插件库。
+ -phonon-backend..... Build the platform phonon plugin.
#编译平台phonon插件库。
-no-svg ............ Do not build the SVG module.
#不编译SVG(可放缩的矢量图形)模块。
+ -svg ............... Build the SVG module.
#编译SVG模块
-no-webkit ......... Do not build the WebKit module.

#不编译WebKit模块。WebKit是一个开源浏览器网页排版引擎。

+ -webkit ............ Build the WebKit module.

#编译WebKit模块。

WebKit is built if a decent C++ compiler is used.

-no-scripttools .... Do not build the QtScriptTools module.

#不编译QtScriptTools模块。

+ -scripttools ....... Build the QtScriptTools module.

#编译QtScriptTools模块。

-platform target ... The operating system and compiler you are building
on (qws/linux-x86-g++). See the README file for a list of supported operating systems and compilers.
-no-mmx ............ Do not compile with use of MMX instructions.
#不编译MMX(MultiMedia eXtensions(多媒体扩展))。

-no-3dnow .......... Do not compile with use of 3DNOW instructions.
#不编译3dnow,3dnow是支持单精度浮点数的矢量运算,用于增强x86架构的计算机在三维图像处理上的性能。
-no-sse ............ Do not compile with use of SSE instructions.
#不编译sse,sse是MMX的扩充指令集。
-no-sse2 ........... Do not compile with use of SSE2 instructions.
-qtnamespace <name> Wraps all Qt library code in 'namespace <name> {...}'.

-qtlibinfix <infix> Renames all libQt*.so to libQt*<infix>.so.

-D <string> ........ Add an explicit define to the preprocessor.

-I <string> ........ Add an explicit include path.

#手动增加头文件绝对路径
-L <string> ........ Add an explicit library path.

#手动增加库文件绝对路径
-help, -h .......... Display this information.
#显示配置帮助信息
Third Party Libraries:

-qt-zlib ........... Use the zlib bundled with Qt.
#使用Qt自带的zlib。zlib是个支持gzip档案格式*.gz的函数库。
+ -system-zlib ....... Use zlib from the operating system.
#使用操作系统自带的zlib。
See http://www.gzip.org/zlib

-no-gif ............ Do not compile the plugin for GIF reading support.
#不编译GIF图片支持插件库。
-qt-gif ............ Compile the plugin for GIF reading support.
#编译GIF支持插件库。
See also src/plugins/imageformats/gif/qgifhandler.h
-no-libtiff ........ Do not compile the plugin for TIFF support.
#不编译TIFF(标签图像文件格式)支持插件库。
-qt-libtiff ........ Use the libtiff bundled with Qt.
#使用Qt打包的libtiff。
+ -system-libtiff .... Use libtiff from the operating system.
#使用操作系统自带的libtiff。
See http://www.libtiff.org

-no-libpng ......... Do not compile in PNG support.
#不编译PNG支持,PNG(Portable Network Graphics)便携式网络图片。
-qt-libpng ......... Use the libpng bundled with Qt.
#使用Qt打包的libpng。
+ -system-libpng ..... Use libpng from the operating system.
#使用操作系统自带的libpng。
See http://www.libpng.org/pub/png

-no-libmng ......... Do not compile the plugin for MNG support.
#不编译MNG支持插件库,MNG是多帧PNG动画图形格式,功能类似GIF。目前多数主流浏览器均不直接支持MNG。
-qt-libmng ......... Use the libmng bundled with Qt.
#使用Qt打包的libmng。
+ -system-libmng ..... Use libmng from the operating system.
#使用操作系统自带的libmng。
See http://www.libmng.com

-no-libjpeg ........ Do not compile the plugin for JPEG support.
#不编译JPEG支持插件库。
-qt-libjpeg ........ Use the libjpeg bundled with Qt.
#使用Qt打包的libjpeg。
+ -system-libjpeg .... Use libjpeg from the operating system.
#使用操作系统自带的libjpeg。
See http://www.ijg.org

-no-openssl ........ Do not compile support for OpenSSL.
#不编译OpenSSL支持,OpenSSL是套开放源代码的SSL套件,实现了基本的传输层资料加密功能,但其授权书条款与GPL有冲突。
+ -openssl ........... Enable run-time OpenSSL support.
#开启运行时OpenSSL支持。
-openssl-linked .... Enabled linked OpenSSL support.
#开启链接OpenSSL支持。
-ptmalloc .......... Override the system memory allocator with ptmalloc.
(Experimental.)
Additional options:

. -make <part> ....... Add part to the list of parts to be built at make time.

(libs tools examples demos docs translations)
-nomake <part> ..... Exclude part from the list of parts to be built.

. -R <string> ........ Add an explicit runtime library path to the Qt

libraries.
-l <string> ........ Add an explicit library.

. -no-rpath .......... Do not use the library install path as a runtime
library path.
.+ -rpath ............. Link Qt libraries and executables using the library ,install path as a runtime library path. Equivalent to -R install_libpath
-verbose, -v ....... Print verbose information about each step of the
configure process.
#在配置的过程中,对每一步都打印出详细的信息。
-continue .......... Continue as far as possible if an error occurs.
#当错误出现时尽可能继续编译。
-silent ............ Reduce the build output so that warnings and errors
can be seen more easily.
-no-optimized-qmake ... Do not build qmake optimized.
#不生成优化过的qmake。
-optimized-qmake ...... Build qmake optimized.
#生成优化过的qmake。
-no-nis ............ Do not compile NIS support.
#不编译NIS支持,NIS(网络信息服务)是一个提供目录服务的RPC(远程过程调用)应用服务。
-nis ............... Compile NIS support.
#NIS支持。
-no-cups ........... Do not compile CUPS support.
#不编译CUPS支持,
-cups .............. Compile CUPS support.
#CUPS支持。
Requires cups/cups.h and libcups.so.2.
-no-iconv .......... Do not compile support for iconv(3).
#不编译iconv支持,iconv是一个计算机程序以及一套应用程序编程接口的名称。它的作用是在多种国际编码格式之间进行文本内码的转换。
-iconv ............. Compile support for iconv(3).
#iconv支持
-no-pch ............ Do not use precompiled header support.
#不使用预编译过的头文件支持。
-pch ............... Use precompiled header support.
#预编译过的头文件支持。预编译头就是把一个工程中的一部分代码,预先编译好放在一个文件里(通常以.pch为扩展名),这个文件就称为预编译头文件。这些预先编译好的代码在工程开发的过程中不会被经常改变。如果这些代码被修改,则需要重新编译生成预编译头文件。
-no-dbus ........... Do not compile the QtDBus module.
#不编译QtDBus模块,D-BUS是一个提供简单的应用程序互相通讯的途径的自由软件项目,允许程序在其上注册以提供服务给其他的程序,同时也提供客户端程序查询有哪些服务是获得的。
+ -dbus .............. Compile the QtDBus module and dynamically load libdbus-1.
#QtDBus模块支持且动态加载libdbus-1。
-dbus-linked ....... Compile the QtDBus module and link to libdbus-1.
-reduce-relocations ..... Reduce relocations in the libraries through extra
linker optimizations (Qt/X11 and Qt for Embedded Linux only;
experimental; needs GNU ld >= 2.18).

-no-separate-debug-info . Do not store debug information in a separate file.
-separate-debug-info .... Strip debug information into a separate .debug file.
Qt for Embedded Linux only:

-xplatform target ... The target platform when cross-compiling.
#交叉编译时的目标平台选择。
-no-feature-<feature> Do not compile in <feature>.

-feature-<feature> .. Compile in <feature>. The available features

are described in src/corelib/global/qfeatures.txt
-embedded <arch> .... This will enable the embedded build, you must have a

proper license for this switch to work.
Example values for <arch>: arm mips x86 generic

-armfpa ............. Target platform is uses the ARM-FPA floating point format.
-no-armfpa .......... Target platform does not use the ARM-FPA floating point format.
The floating point format is usually autodetected by configure. Use this to override the detected value.
-little-endian ...... Target platform is little endian (LSB first).
-big-endian ......... Target platform is big endian (MSB first).
-host-little-endian . Host platform is little endian (LSB first).
-host-big-endian .... Host platform is big endian (MSB first).
You only need to specify the endianness when cross-compiling, otherwise the host endianness will be used.
-no-freetype ........ Do not compile in Freetype2 support.
#不编译Freetype2支持,Freetype2是一个简单的跨平台的字体绘制引擎,可以被用在诸如图像库、展出服务器、字体转换工具、图像文字产生工具等多种其它产品上。
-qt-freetype ........ Use the libfreetype bundled with Qt.
#使用Qt打包的libfreetype。
-system-libfreetype. Use libfreetype from the operating system.
#使用操作系统自带的libfreetype。
See http://www.freetype.org/

-qconfig local ...... Use src/corelib/global/qconfig-local.h rather than the
default (full).
-depths <list> ...... Comma-separated list of supported bit-per-pixel

depths, from: 1, 4, 8, 12, 15, 16, 18, 24, 32 and 'all'.
-qt-decoration-<style> ....Enable a decoration <style> in the QtGui library,

by default all available decorations are on.
Possible values for <style>: [ styled windows default ]

-plugin-decoration-<style> Enable decoration <style> as a plugin to be

linked to at run time.
Possible values for <style>: [ default styled windows ]

-no-decoration-<style> ....Disable decoration <style> entirely.

Possible values for <style>: [ styled windows default ]

-no-opengl .......... Do not support OpenGL.
-opengl <api> ....... Enable OpenGL ES support

With no parameter, this will attempt to auto-detect OpenGL ES 1.x
or 2.x. Use es1, es1cl or es2 for <api> to override auto-detection. NOTE: A QGLScreen driver for the hardware is required to support

OpenGL ES on Qt for Embedded Linux.
-qt-gfx-<driver> ... Enable a graphics <driver> in the QtGui library.

#开启QtGui库中的图形驱动支持。

Possible values for <driver>: [ linuxfb transformed qvfb vnc multiscreen ]

-plugin-gfx-<driver> Enable graphics <driver> as a plugin to be

linked to at run time.
Possible values for <driver>: [ ahi directfb hybrid linuxfb powervr qvfb transformed vnc ]

-no-gfx-<driver> ... Disable graphics <driver> entirely.

Possible values for <driver>: [ linuxfb transformed qvfb vnc multiscreen ]

-qt-kbd-<driver> ... Enable a keyboard <driver> in the QtGui library.

#开启QtGui库中的键盘驱动支持。

Possible values for <driver>: [ tty usb sl5000 yopy vr41xx qvfb ]

-plugin-kbd-<driver> Enable keyboard <driver> as a plugin to be linked to

at runtime.
Possible values for <driver>: [ linuxis sl5000 usb vr41xx yopy ]

-no-kbd-<driver> ... Disable keyboard <driver> entirely.

Possible values for <driver>: [ tty usb sl5000 yopy vr41xx qvfb ]

-qt-mouse-<driver> ... Enable a mouse <driver> in the QtGui library.

#开启QtGui库中的鼠标驱动支持。

Possible values for <driver>: [ pc bus linuxtp yopy vr41xx tslib qvfb ]

-plugin-mouse-<driver> Enable mouse <driver> as a plugin to be linked to

at runtime.
Possible values for <driver>: [ bus linuxis linuxtp pc tslib vr41xx yopy ]

-no-mouse-<driver> ... Disable mouse <driver> entirely.

Possible values for <driver>: [ pc bus linuxtp yopy vr41xx tslib qvfb ]

-iwmmxt ............ Compile using the iWMMXt instruction set
(available on some XScale CPUs).
-no-glib ........... Do not compile Glib support.
#不编译Glib支持。
+ -glib .............. Compile Glib support.

#GNOME的Glib支持。


交叉编译Qt4.8.2

1. 安装交叉编译器。利用友善之臂自带的交叉编译器。
将arm-linux-gcc-4.3.2.tgz 放在 /root下,执行如下操作
#cd /root
#tar xvzf arm-linux-gcc-4.3.2.tgz –C /
#gedit /root/.bashrc
在bashrc最后一行添加 export PATH=$PATH:/usr/local/arm/4.3.2/bin
#source /root/.bashrc
#arm-linux-gcc -v
查看交叉编译器版本为4.3.2

2. 编辑tslib对触摸屏的支持
将tslib1.4.tar.gz 放在/root 下,解压并编译:
# cd /root
# tar zxvf tslib1.4.tar.gz
# cd tslib
# ./autogen.sh
# ./configure –prefix=/usr/local/tslib/ –host=arm-linux ac_cv_func_malloc_0_nonnull=yes
# make
# make install

3. 配置QtE4.8
将qt-everywhere-opensource-src-4.8.0.tar.gz压缩包放在/opt下,解压:
#cd /opt
#tar zxvf qt-everywhere-opensource-src-4.8.0.tar.gz
#mv qt-everywhere-opensource-src-4.8.0 qt-4.8.0-arm
#cd qt-4.7.0-arm
3.1制作一个配置脚本
#gedit autoconfig.sh
编辑文件如下:

#!/bin/bash

./configure \
-prefix /usr/local/Trolltech/QtEmbedded-4.8.2-arm \
-opensource \
-confirm-license \
-release -shared \
-embedded arm \
-xplatform qws/linux-arm-g++ \
-depths 16,18,24 \
-fast \
-optimized-qmake \
-pch \
-qt-sql-sqlite \
-qt-libjpeg \
-qt-zlib \
-qt-libpng \
-qt-freetype \
-little-endian -host-little-endian \
-no-qt3support \
-no-libtiff -no-libmng \
-no-opengl \
-no-mmx -no-sse -no-sse2 \
-no-3dnow \
-no-openssl \
-no-webkit \
-no-qvfb \
-no-phonon \
-no-nis \
-no-opengl \
-no-cups \
-no-glib \
-no-xcursor -no-xfixes -no-xrandr -no-xrender \
-no-separate-debug-info \
-nomake examples -nomake tools -nomake docs \
-qt-mouse-tslib
-I/usr/local/tslib/include \
-L/usr/local/tslib/lib

exit

3.2生成Makefile文件并编译安装
#chmod 755 autoconfig.sh
#./autoconfig.sh
#gmake
#gmake install

3.3 移植到mini2440
安装完成后 将/usr/local/Trolltech/QtEmbedded-4.8.0-arm/lib/fonts中的字体全部删除 将 wenquanyi_120_50.qpf字体复制到fonts下:
#rm –rf /usr/local/Trolltech/QtEmbedded-4.8.0-arm/lib/fonts/*
#cp wenquanyi_120_50.qpf /usr/local/Trolltech/QtEmbedded-4.8.0-arm/lib/fonts/
3.4 制作开发板文件系统
将root_qtopia-20100108.tar.gz 和 mkyaffs2image.tgz放在/root下。删除qtopia图形界面系统,删除root文件夹下占存储较大的文件。复制/usr/local/Trolltech/QtEmbedded-4.8.0-arm/lib 文件夹到 /root/root_qtopia/ usr/local/Trolltech/QtEmbedded-4.8.0-arm, 复制 /usr/local/tslib下所有内容到 /root/root_qtopia/usr/local/,修改触摸屏配置文件 ts.conf, 修改环境变量,修改自启动文件 /root/root_qtopia/etc/init.d/rcS。最后将mkyaffs2image 工具生成文件系统镜像。
#cd /root
#tar zxvf root_qtopia-20100108.tar.gz
#tar zxvf mkyaffs2image.tgz
#cd root_qtopia
#rm –rf opt/Qtopia
#rm –rf root/Documents/*
#mkdir -p usr/local/Trolltech/QtEmbedded-4.8.0-arm
#cp –r /usr/local/Trolltech/QtEmbedded-4.8.0-arm/lib usr/local/Trolltech/QtEmbedded-4.8.0-arm
#cp –r /usr/local/tslib/* usr/local/
#gedit usr/local/etc/ts.conf
#gedit etc/profile
#gedit etc/init.d/rcS
#cd /root
#mkyaffs2image root_qtopia root_qt-4.8.0.img
usr/local/etc/ts.conf: 取消注释 module_raw input
etc/profile:在最后添加
export QTDIR=/usr/local/Trolltech/QtEmbedded-4.8.0-arm
export T_ROOT=/usr/local
export PATH=$QTDIR/bin:$PATH
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_PLUGINDIR=$T_ROOT/lib/ts
export TSLIB_CONFFILE=$T_ROOT/etc/ts.conf
export TSLIB_CALIBFILE=/etc/pointercal
export QWS_MOUSE_PROTO=Tslib:/dev/input/event0
export LD_LIBRARY_PATH=$T_ROOT/lib:$QTDIR/lib
etc/init.d/rcS:
删除:
/bin/qtopia &
echo ” ” > /dev/tty1
echo “Starting Qtopia, please waiting…” > /dev/tty1
添加:
source /etc/profile
echo ” ” > /dev/tty1
echo “Starting touch calibrate ” > /dev/tty1
echo ” ” > /dev/tty1
sleep 1
/usr/local/bin/ts_calibrate &

3.5 下载内核,文件系统到mini2440
linux-2.6.32.img
root_qt-4.8.0.img
至此Qt4.8.0移植完成..


Qtcreator配置、交叉编译arm程序

转自:http://blog.csdn.net/embeddedman/article/details/7423107


$ git clone https://github.com/kergoth/tslib
编译过程如下:
$ ./autogen.sh
$ #./configure --host=arm-linux --prefix=/home/latelee/lib/tslib
$ sudo  ./configure --prefix=/usr/local/tslib/ --host=arm-linux-gnueabihf ac_cv_func_malloc_0_nonnull=yes

$ make
$ make install


下载:qt-creator-linux-x86_64-opensource-2.5.2.bin


chmod +x qt-creator-linux-x86_64-opensource-2.5.2.bin

./qt-creator-linux-x86_64-opensource-2.5.2.bin


大家知道在windows下使用qtcreator集成IDE开发环境开发Qt程序,甚至是其他与Qt无关的程序,在此过程中大家也可能感受到了它的魅力,呵呵,那么,各位朋友有没有使用它在Linux下开发自己的程序了?更有甚者,用它来交叉编译arm程序了?答案是可能的,而且相当方便。好了,下面我来带大家感受它的魅力吧!!!

一、下载安装Linux下的QtCreator安装包(如:qt-creator-linux-x86-opensource-2.4.1.bin)网址:http://qt.nokia.com/downloads/qt-creator-binary-for-linux-x11-32-bit;大家根据自己的系统选择是32位的还是64位的安装包;


二、解压上文的安装包

  1、修改安装包的可执行权限;

[root@localhost ~]# chmod +x qt-creator-linux-x86-opensource-2.4.1.bin

  2、安装qtcreator

[root@localhost ~]# ./qt-creator-linux-x86-opensource-2.4.1.bin
  3、就会出现安装向导;


接下来的安装就如同windows下按章软件那么简单,在此不再啰嗦。


三、配置Qtcreator环境

  进行此步骤的前提是你的Linux系统编译安装了qt库,库的安装步骤我就不介绍了。

  注意:如果你是只做x86 pc机下配置,安装qt库的时候就是常规的编译安装qt库,如果你是移植相关的qt程序代码到arm下运行,那么qt就得交叉编译,交叉编译就得安装交叉编译器;我的目录为:/opt/toolchain/4.4.3。

  下面我将介绍交叉编译qt库:

  1、qt-everywhere-opensource-src-4.6.4.tar.gz(我的qt库安装包,qt.nokia.com有下载)

  2、交叉编译工具链:(我的友善之臂提供arm-linux-gcc4.4.3)

   我的安装目录如下:

/opt/toolchain/4.4.3/,进入交叉编译器的bin目录,你就会发现:
arm-linux-addr2line     arm-none-linux-gnueabi-addr2line
arm-linux-ar            arm-none-linux-gnueabi-ar
arm-linux-as            arm-none-linux-gnueabi-as
arm-linux-c++           arm-none-linux-gnueabi-c++
arm-linux-cc            arm-none-linux-gnueabi-cc
arm-linux-c++filt       arm-none-linux-gnueabi-c++filt
arm-linux-cpp           arm-none-linux-gnueabi-cpp
arm-linux-ct-ng.config  arm-none-linux-gnueabi-ct-ng.config
arm-linux-g++           arm-none-linux-gnueabi-g++
arm-linux-gcc           arm-none-linux-gnueabi-gcc
arm-linux-gcc-4.4.3     arm-none-linux-gnueabi-gcc-4.4.3
arm-linux-gccbug        arm-none-linux-gnueabi-gccbug
arm-linux-gcov          arm-none-linux-gnueabi-gcov
arm-linux-gprof         arm-none-linux-gnueabi-gprof
arm-linux-ld            arm-none-linux-gnueabi-ld
arm-linux-nm            arm-none-linux-gnueabi-nm
arm-linux-objcopy       arm-none-linux-gnueabi-objcopy
arm-linux-objdump       arm-none-linux-gnueabi-objdump
arm-linux-populate      arm-none-linux-gnueabi-populate
arm-linux-ranlib        arm-none-linux-gnueabi-ranlib
arm-linux-readelf       arm-none-linux-gnueabi-readelf
arm-linux-size          arm-none-linux-gnueabi-size
arm-linux-strings       arm-none-linux-gnueabi-strings
arm-linux-strip         arm-none-linux-gnueabi-strip

等等。

  3、在linux 下/opt目录建立自己的qt库编译目录,我的安装如下:

[root@localhost opt]# mkdir qt4.6.4_src

然后将qt-everywhere-opensource-src-4.6.4.tar.gz拷贝至qt4.6.4_src目录;

进入qt4.6.4_src目录,在此目录下建立脚本,这个脚本方便大家一键编译、安装啦

[root@localhost qt4.6.4_src]# vim build-all

内容如下:

#/bin/bash

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


rm -fr qt-everywhere-opensource-src-4.6.4
rm -fr Qt4.6.4_forArm

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

cd qt-everywhere-opensource-src-4.6.4

echo yes | ./configure -opensource -embedded arm -xplatform qws/linux-arm-g++  -no-webkit -qt-libtiff -qt-libmng  -qt-mouse-tslib -q
t-mouse-pc -no-mouse-linuxtp -prefix /opt/Qt4.6.4_forArm   -I /usr/local/arm/tslib/tslib/include -L /usr/local/arm/tslib/tslib/lib

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

保存退出后修改脚本的可执行权限:chmod +x buid-all;

4、./build-all执行咯,没错误的话就可以安装成功了,由于本人在build-all脚本制定安装目录为:/opt/Qt4.6.4_forArm,所以就可以在此目录下找到相关的安装库文件等等咯!

这里提示大家,交叉编译qt库之前最好交叉编译安装tslib,哈哈,这里不做介绍,可以参考本人其他博文(Mini2440移植qt-extended4.4.3)。

5、接下来就是配置qtcreator交叉环境咯,方便大家开发arm下的qt应用程序;Linux下启动qtcreator:



配置针对arm的交叉编译环境:



由于上文提到本人的Qt交叉编译暗转的路径为:/opt/Qt4.6.4_forArm,进入此目录可以看到里面的bin目录,进入bin目录可可以发现qmake了吧,


ok后,紧接着就是设置交叉工具链:

设置完成后,就可以打开qt自带的例子工程,进行编译了。


写此文的时候参考了天嵌科技出品--Qt程序开发完全手册(上)之24小时超级版本_第二版_20091216.pdf,在此表示感谢,时间仓促,难免疏漏。

Logo

更多推荐