打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
ubuntu10.10建立QT开发环境图文详解

说明:本文共分两部分,可以在阅读完该部分后点击文章后的链接进入下一部分。这个教程包含了对linux下桌面版本的Qt及Qt Creator的安装和ARM开发板上的Qt的安装过程,如果大家已经安装了桌面版本的Qt,可以跳过前面的这些内容。

一、安装g++,ubuntu默认是不带g++的,如果不安装的话,后面是无法进行桌面版的qt应用程序进行编译的,在终端中执行以下命令:

sudo apt-get install g++

 

二、安装arm-linux-gcc 3.3.2

我们使用的是优龙公司提供的arm-linux-gcc 3.3.2交叉编译工具链

注:这里推荐使用友善之臂的4.4.3版本工具链,当然,这样的话你需要保证你板子上的环境也是最新的,不然编译出来的程序可能无法运行。

4.4.3工具链可以到友善之臂官网下载,也可以下载我们上传到网盘上的。)

(1)在/usr/local目录下arm目录,用于存放解压后的交叉编译工具链

sise@sise:~/sisefile/crosschain$ cd /usr/local/

sise@sise:/usr/local$ sudo mkdir arm

 

(2)解压交叉编译工具链

sise@sise:~$ cd sisefile/crosschain/

sise@sise:~/sisefile/crosschain$ sudo tar -jxvf cross-3.3.2.tar.bz2 -C /usr/local/arm

 

(3)查看目录

sise@sise:~/sisefile/crosschain$ cd /usr/local/arm/3.3.2/

sise@sise:/usr/local/arm/3.3.2$ ls

 

(4)添加交叉编译工具链环境变量

X方法一:

建立环境变量设置脚本:

sise@sise:/usr/local/arm/3.3.2$ sudo gedit arm-linux-gcc-3.3.2-env.sh

添加以下内容:

# add my crosschain(arm-linux-gcc-3.3.2) path

export PATH=/usr/local/arm/3.3.2/bin$:PATH 

使用arm-linux-gcc 3.3.2时,可以进入存放arm-linux-gcc-3.3.2-env.sh的目录,在终端执行以下命令:

source arm-linux-gcc-3.3.2-env.sh

这样就能使arm-linux-gcc-3.3.2-env.sh生效

方法二:

修改profile文件:

sise@sise:/usr/local/arm/3.3.2$ sudo gedit /etc/profile

 

添加以下内容:

# add arm-linux-gcc 3.3.2 crosschain path

export PATH=/usr/local/arm/3.3.2/bin:$PATH

 

 

三、安装桌面版QT

(1)为QT增加可执行属性

sise@sise:/usr/local/arm/3.3.2$ cd /home/sise/sisefile/qt4/

sise@sise:~/sisefile/qt4$ sudo chmod +x qt-sdk-linux-x86-opensource-2010.04.bin 

(2)执行qt的二进制文件:

sise@sise:~/sisefile/qt4$ ./qt-sdk-linux-x86-opensource-2010.04.bin

 

安装QT的过程:

 

 

我修改了安装目录,具体目录如下:

这里一步要注意了,这里有提示说如果我们要使用qt,需要安装以下的文件:

提示内容:

Apart from a C++ compiler, a number of development libraries need to be present to enable Qt Creator to build your Qt applications. On Debian and Ubuntu, use the following command in a terminal to make sure they are installed:

  sudo apt-get install libglib2.0-dev libSM-dev libxrender-dev libfontconfig1-dev libxext-dev

If you’re using QtOpenGL, you’ll also need OpenGL development files. You can use the following command to find out which packages to install:

  sudo apt-get install libgl-dev libglu-dev

(3)安装libgl-dev libglu-dev包:

sise@sise:~/sisefile/qt4$ sudo apt-get install libglib2.0-dev libSM-dev libxrender-dev libfontconfig1-dev libxext-dev

(4)安装libgl-dev libglu-dev包:

sise@sise:/usr/local/arm/3.3.2$ sudo apt-get install libgl-dev libglu-dev

提示没有libgl-dev包

(5)安装libgl1-mesa-dev libglu-dev包:

sise@sise:/usr/local/arm/3.3.2$ sudo apt-get install libgl1-mesa-dev libglu-dev

至此桌面版的QT就安装完成了

(6)添加环境变量

添加在qcreator中环境变量(其实这一步时不需要的,因为在qt安装完成后,不需要再设置环境变量的)

找到qmake

(7)建立一个helloword工程测试:

选择qt的版本

向工程中添加一个c++文件:

在main.cpp文件中添加以下代码:

#include <QApplication>

#include <QLabel>

int main(int argc,char* argv[])

{

        QApplication app(argc,argv);

        QLabel* label = new QLabel(“hello world”);

        label->show();

        return app.exec();

}

编译

出现以下的窗口,证明我们已经完成了qt的安装:

(8)编译qvfb

qvfb是个X11模式下的qte的模拟器,没有开发板的同学可以利用qvfb来仿真qte的程序。

在安装qt的文件夹中已经包含了qvfb的工程,我们需要的是对它进行编译:

打开qvfb.pro,然后编译,出现了一下错误:

这是由于缺少了deviceskin.h和deviceskin.cpp文件,在安装qt的文件夹中同样存在这两个文件

将这两个文件复制到qvfb工程目录中

重新打开工程,编译,出现以下错误:

这是由于缺少png库,安装png库:

sise@sise:~$ sudo apt-get install libpng-dev

继续编译,又出现以下错误:

这是由于系统缺少glui和xorg库,安装glui和xorg库:

sise@sise:~$ sudo apt-get install libglui-dev

sise@sise:~$ sudo apt-get install xorg-dev

重新编译qvfb工程,出现以下窗口,这时终于成功了!

生成的文件在qt/bin目录下:

设置qvfb的环境变量:

# add qt4.6.3 for x86 path

export PATH=/home/sise/siseapp/qtsdk-2010.04/qt/bin:$PATH


四、安装qt-embedded-x86版的qt

(1)进入siseapp目录,建立qt4.6.3_embedded_x86文件夹,用来存放解压后的该版本的qt

sise@sise:~$ cd siseapp/

sise@sise:~/siseapp$ mkdir qt4.6.3_embedded_x86

(2)解压qt源文件文件,制定解压后存放的目录为刚才建立的目录:

sise@sise:~/siseapp$ cd /home/sise/sisefile/qt4/

sise@sise:~/sisefile/qt4$ tar -zvxf qt-everywhere-opensource-src-4.6.3.tar.gz -C /home/sise/siseapp/qt4.6.3_embedded_x86

(3)配置qt的编译选项:

sise@sise:~/sisefile/qt4$ cd /home/sise/siseapp/qt4.6.3_embedded_x86/qt-everywhere-opensource-src-4.6.3/

sise@sise:~/siseapp/qt4.6.3_embedded_x86/qt-everywhere-opensource-src-4.6.3$ ./configure -prefix /home/sise/siseapp/qt-embedded-4.6.3-x86 -embedded x86 -qvfb

选择 o

选择yes

(4)编译

sise@sise:~/siseapp/qt4.6.3_embedded_x86/qt-everywhere-opensource-src-4.6.3$ make

安装

sise@sise:~/siseapp/qt4.6.3_embedded_x86/qt-everywhere-opensource-src-4.6.3$ make install

在qcreator中添加刚才编译的qt版本的环境变量:

(5)重新利用该版本的qt编译helloworld工程

打开helloworld工程:

选择该版本qt的环境变量

设置run setting

我们先打开qvfb

sise@sise:~/siseapp/qt4.6.3_embedded_x86/qt-everywhere-opensource-src-4.6.3$ qvfb &

然后编译仿真,出现以下窗口,证明我们的qt又编译成功了:

五、编译安装tslib 

Tslib是一个开源的程序,能够为触摸屏驱动获得的采样提供诸如滤波、去抖、校准等功能,通常作为触摸屏驱动的适配层,为上层的应用提供了一个统一的接口。(下载tslib1.4

(1)进入tslib存放源文件的文件夹,解压tslib

sise@sise:~$ cd sisefile/tslib1.4/

sise@sise:~/sisefile/tslib1.4$ tar -zxvf tslib-1.4.tar.gz

(2)注:此步需要一些工具,ubuntu下需要安装automake、autoconf、libtool,可以执行下面语句安装,sudo apt-get install automake autoconf libtool,不然的话,我们是无法执行autogen.sh脚本的:

sise@sise:~/sisefile/tslib1.4$ sudo apt-get install automake autoconf libtool

(3)进入解压后的tslib文件夹,执行autogen.sh脚本文件:

sise@sise:~/sisefile/tslib1.4$ cd tslib/

sise@sise:~/sisefile/tslib1.4/tslib$ ./autogen.sh

(4)配置tslib的选项:

sise@sise:~/sisefile/tslib1.4/tslib$ ./configure –prefix=/usr/local/tslib/ –host=arm-linux ac_cv_func_malloc_0_nonnull=yes

(5)编译tslib

sise@sise:~/sisefile/tslib1.4/tslib$ make

(6)安装tslib

sise@sise:~/sisefile/tslib1.4/tslib$ sudo make install

(7)修改ts.conf

sise@sise:~/sisefile/tslib1.4/tslib$ sudo gedit /usr/local/tslib/etc/ts.conf

将第二行“#module_raw input”注释去掉,变为“module_raw input”,注意一定要顶格。

(8)以下内容是在开发板的linux系统中修改的,现在由于优龙fs2410使用的cramfs文件系统是只读的,我们无法修改,这个要等到我们做出yaffs文件系统后,才能做。

打开profile

$vi /etc/profile

添加内容如下:

export TSLIB_ROOT=/tslib
export TSLIB_TSDEVICE=/dev/event0
export LD_LIBRARY_PATH=/tslib/lib:$LD_LIBRARY_PATH
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_PLUGINDIR=/tslib/lib/ts
export TSLIB_CONSOLEDEVICE=none
export TSLIB_CONFFILE=/tslib/etc/ts.conf
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_TSEVENTTYPE=”H3600″
export QWS_SIZE=320*240
export QWS_MOUSE_PROTO=Tslib:/dev/event0
export QWS_DISPLAY=”LinuxFb:mmWidth50:mmHeight65:0″
export POINTERCAL_FILE=/etc/pointercal
export QWS_SW_CURSOR
export QWS_KEYBOARD=”TTY:/dev/tty1″

export set QTDIR=/opt/qt
export PATH=$QTDIR:$PATH
export LD_LIBRARY_PATH=$QTDIR/lib:$QTDIR/plugins/imageformats:$LD_LIBRARY_PATH
export QT_PLUGIN_PATH=$QTDIR/plugins/
export QT_QWS_FONTDIR=$QTDIR/lib/fonts

六、安装armqt

(1)建立存放解压后的qt的文件夹

sise@sise:~/sisefile/tslib1.4/tslib$ cd /home/sise/siseapp/

sise@sise:~/siseapp$ mkdir qt-embedded-4.6.3-arm

sise@sise:~/siseapp$ mkdir qt_4.6.3_embedded_arm

(2)解压qt

sise@sise:~/siseapp$ cd /home/sise/sisefile/qt4/

sise@sise:~/sisefile/qt4$ ls

qt-everywhere-opensource-src-4.6.3.tar.gz

qt-sdk-linux-x86-opensource-2010.04.bin

sise@sise:~/sisefile/qt4$ tar -zvxf qt-everywhere-opensource-src-4.6.3.tar.gz -C /home/sise/siseapp/qt_4.6.3_embedded_arm/

(3)安装libjpeg-dev

sise@sise:~/siseapp/qt_4.6.3_embedded_arm/qt-everywhere-opensource-src-4.6.3$ sudo apt-get install libjpeg-dev

(4)我们来查看一下qt有哪些可选的配置编译选项:

输入以下命令:

sise@sise:~/siseapp/qt_4.6.3_embedded_arm/qt-everywhere-opensource-src-4.6.3$ ./configure –help

可以看到以下的选项

Usage:  configure [-h] [-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] [-developer-build] [-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] [-qt-libtiff] [-system-libtiff]

        [-no-libpng] [-qt-libpng] [-system-libpng] [-no-libmng] [-qt-libmng]

        [-system-libmng] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg] [-make <part>]

        [-nomake <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>] [-qtlibinfix <infix>] [-separate-debug-info] [-armfpa]

        [-no-optimized-qmake] [-optimized-qmake] [-no-xmlpatterns] [-xmlpatterns]

        [-no-multimedia] [-multimedia] [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend]

        [-no-audio-backend] [-audio-backend] [-no-openssl] [-openssl] [-openssl-linked]

        [-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit] [-no-javascript-jit] [-javascript-jit]

        [-no-script] [-script] [-no-scripttools] [-scripttools] [-no-declarative] [-declarative]

        [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/Qt-4.6.3)

  * -prefix-install …. Force a sandboxed “local” installation of

                         Qt. This will install into

                         /usr/local/Trolltech/Qt-4.6.3, 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 …………. Compile and link Qt with debugging turned on.

    -debug-and-release . Compile and link two versions of Qt, with and without

                         debugging turned on (Mac only).

    -developer-build … Compile and link Qt with Qt developer options (including auto-tests exporting)

    -opensource …….. Compile and link the Open-Source Edition of Qt.

    -commercial …….. Compile and link the Commercial Edition of Qt.

 *  -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.

    -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.

    -no-largefile …… Disables large file support.

 +  -largefile ……… Enables Qt to access files larger than 4 GB.

    -no-exceptions ….. Disable exceptions on compilers that support it.

 *  -exceptions …….. Enable exceptions on compilers that support it.

    -no-accessibility .. Do not compile Accessibility support.

 *  -accessibility ….. Compile Accessibility support.

    -no-stl ………… Do not compile STL support.

 *  -stl …………… Compile STL support.

    -no-sql-<driver> … Disable SQL <driver> entirely.

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

                         none are turned on.

    -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 sqlite_symbian tds ]

    -system-sqlite ….. Use sqlite from the operating system.

    -no-qt3support ….. Disables the Qt 3 support functionality.

 *  -qt3support …….. Enables the Qt 3 support functionality.

    -no-xmlpatterns …. Do not build the QtXmlPatterns module.

 +  -xmlpatterns ……. Build the QtXmlPatterns module.

                         QtXmlPatterns is built if a decent C++ compiler

                         is used and exceptions are enabled.

    -no-multimedia ….. Do not build the QtMultimedia module.

 +  -multimedia …….. Build the QtMultimedia module.

    -no-audio-backend .. Do not build the platform audio backend into QtMultimedia.

 +  -audio-backend ….. Build the platform audio backend into QtMultimedia if available.

    -no-phonon ……… Do not build the Phonon module.

 +  -phonon ………… Build the Phonon module.

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

    -no-phonon-backend.. Do not build the platform phonon plugin.

 +  -phonon-backend….. Build the platform phonon plugin.

    -no-svg ………… Do not build the SVG module.

 +  -svg …………… Build the SVG module.

    -no-webkit ……… Do not build the WebKit module.

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

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

    -no-javascript-jit . Do not build the JavaScriptCore JIT compiler.

 +  -javascript-jit …. Build the JavaScriptCore JIT compiler.

    -no-script ……… Do not build the QtScript module.

 +  -script ………… Build the QtScript module.

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

 +  -scripttools ……. Build the QtScriptTools module.

 +  -no-declarative …..Do not build the declarative module.

    -declarative ……. Build the declarative module.

    -platform target … The operating system and compiler you are building

                         on (linux-g++).

                         See the README file for a list of supported

                         operating systems and compilers.

    -graphicssystem <sys> Sets an alternate graphics system. Available options are:

                           raster – Software rasterizer

                           opengl – Rendering via OpenGL, Experimental!

    -no-mmx ………… Do not compile with use of MMX instructions.

    -no-3dnow ………. Do not compile with use of 3DNOW instructions.

    -no-sse ………… Do not compile with use of SSE instructions.

    -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.

 +  -system-zlib ……. Use zlib from the operating system.

                         See http://www.gzip.org/zlib

    -no-gif ………… Do not compile the plugin for GIF reading support.

 *  -qt-gif ………… Compile the plugin for GIF reading support.

                         See also src/plugins/imageformats/gif/qgifhandler.h

    -no-libtiff …….. Do not compile the plugin for TIFF support.

    -qt-libtiff …….. Use the libtiff bundled with Qt.

 +  -system-libtiff …. Use libtiff from the operating system.

                         See http://www.libtiff.org

    -no-libpng ……… Do not compile in PNG support.

    -qt-libpng ……… Use the libpng bundled with Qt.

 +  -system-libpng ….. Use libpng from the operating system.

                         See http://www.libpng.org/pub/png

    -no-libmng ……… Do not compile the plugin for MNG support.

    -qt-libmng ……… Use the libmng bundled with Qt.

 +  -system-libmng ….. Use libmng from the operating system.

                         See http://www.libmng.com

    -no-libjpeg …….. Do not compile the plugin for JPEG support.

    -qt-libjpeg …….. Use the libjpeg bundled with Qt.

 +  -system-libjpeg …. Use libjpeg from the operating system.

                         See http://www.ijg.org

    -no-openssl …….. Do not compile support for OpenSSL.

 +  -openssl ……….. Enable run-time OpenSSL support.

    -openssl-linked …. Enabled linked OpenSSL support.

    -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

    -continue ………. Continue as far as possible if an error occurs.

    -verbose, -v ……. Print verbose information about each step of the

                         configure process.

    -silent ………… Reduce the build output so that warnings and errors

                         can be seen more easily.

 *  -no-optimized-qmake … Do not build qmake optimized.

    -optimized-qmake …… Build qmake optimized.

    -no-nis ………… Do not compile NIS support.

 *  -nis …………… Compile NIS support.

    -no-cups ……….. Do not compile CUPS support.

 *  -cups ………….. Compile CUPS support.

                         Requires cups/cups.h and libcups.so.2.

    -no-iconv ………. Do not compile support for iconv(3).

 *  -iconv …………. Compile support for iconv(3).

    -no-pch ………… Do not use precompiled header support.

 *  -pch …………… Use precompiled header support.

    -no-dbus ……….. Do not compile the QtDBus module.

 +  -dbus ………….. Compile the QtDBus module and dynamically load 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/X11 only:

    -no-gtkstyle ……. Do not build the GTK theme integration.

 +  -gtkstyle ………. Build the GTK theme integration.

 *  -no-nas-sound …… Do not compile in NAS sound support.

    -system-nas-sound .. Use NAS libaudio from the operating system.

                         See http://radscan.com/nas.html

    -no-opengl ……… Do not support OpenGL.

 +  -opengl <api> …… Enable OpenGL support.

                         With no parameter, this will auto-detect the “best”

                         OpenGL API to use. If desktop OpenGL is available, it

                         will be used. Use desktop, es1, es1cl or es2 for <api>

                         to force the use of the Desktop (OpenGL 1.x or 2.x),

                         OpenGL ES 1.x Common profile, 1.x Common Lite profile

                         or 2.x APIs instead. On X11, the EGL API will be used

                         to manage GL contexts in the case of OpenGL ES

     -no-openvg …….. Do not support OpenVG.

 +   -openvg ……….. Enable OpenVG support.

                         Requires EGL support, typically supplied by an OpenGL

                         or other graphics implementation.

    -no-sm …………. Do not support X Session Management.

 *  -sm ……………. Support X Session Management, links in -lSM -lICE.

    -no-xshape ……… Do not compile XShape support.

 *  -xshape ………… Compile XShape support.

                         Requires X11/extensions/shape.h.

    -no-xsync ………. Do not compile XSync support.

 *  -xsync …………. Compile XSync support.

                         Requires X11/extensions/sync.h.

    -no-xinerama ……. Do not compile Xinerama (multihead) support.

 *  -xinerama ………. Compile Xinerama support.

                         Requires X11/extensions/Xinerama.h and libXinerama.

                             By default, Xinerama support will be compiled if

                         available and the shared libraries are dynamically

                         loaded at runtime.

    -no-xcursor …….. Do not compile Xcursor support.

 *  -xcursor ……….. Compile Xcursor support.

                         Requires X11/Xcursor/Xcursor.h and libXcursor.

                             By default, Xcursor support will be compiled if

                         available and the shared libraries are dynamically

                         loaded at runtime.

    -no-xfixes ……… Do not compile Xfixes support.

 *  -xfixes ………… Compile Xfixes support.

                         Requires X11/extensions/Xfixes.h and libXfixes.

                             By default, Xfixes support will be compiled if

                         available and the shared libraries are dynamically

                         loaded at runtime.

    -no-xrandr ……… Do not compile Xrandr (resize and rotate) support.

 *  -xrandr ………… Compile Xrandr support.

                         Requires X11/extensions/Xrandr.h and libXrandr.

    -no-xrender …….. Do not compile Xrender support.

 *  -xrender ……….. Compile Xrender support.

                         Requires X11/extensions/Xrender.h and libXrender.

    -no-mitshm ……… Do not compile MIT-SHM support.

 *  -mitshm ………… Compile MIT-SHM support.

                         Requires sys/ipc.h, sys/shm.h and X11/extensions/XShm.h

    -no-fontconfig ….. Do not compile FontConfig (anti-aliased font) support.

 *  -fontconfig …….. Compile FontConfig support.

                         Requires fontconfig/fontconfig.h, libfontconfig,

                         freetype.h and libfreetype.

    -no-xinput ……… Do not compile Xinput support.

 *  -xinput ………… Compile Xinput support. This also enabled tablet support

                         which requires IRIX with wacom.h and libXi or

                         XFree86 with X11/extensions/XInput.h and libXi.

    -no-xkb ………… Do not compile XKB (X KeyBoard extension) support.

 *  -xkb …………… Compile XKB support.

    -no-glib ……….. Do not compile Glib support.

 +  -glib ………….. Compile Glib support.

我们现在就选择要qt的编译配置,这是我选的配置,具体的作用大家可以查看上述的选项:

sise@sise:~/siseapp/qt_4.6.3_embedded_arm/qt-everywhere-opensource-src-4.6.3$ ./configure -prefix /usr/local/Trolltech/QtEmbedded-4.6.3-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-qvfb -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

这里要注意的是,-qt-mouse-tslib -I/usr/local/tslib/include -L/usr/local/tslib/lib这句很重要的,这是让QT支持触摸屏,而且要使用到我们刚才编译过的tslib

配置完成后,开始编译:

sise@sise:~/siseapp/qt_4.6.3_embedded_arm/qt-everywhere-opensource-src-4.6.3$ make

以下出现的错误是因为我使用了arm-linux-gcc 3.3.2,而qt4.6.3是需要arm-linux-gcc 4版本以上的,否则会出现语法错误。

 

arm-linux-g++: 语言 c++-header 未能被识别

arm-linux-g++: global/qt_pch.h:未使用链接器输入文件,因为链接尚未完成

arm-linux-g++ -c -include .pch/release-shared-emb-arm/QtCore -pipe -I/usr/local/tslib/include -fno-exceptions -O2 -Wall -W -D_REENTRANT -fPIC -DQT_SHARED -DQT_BUILD_CORE_LIB -DQT_NO_USING_NAMESPACE -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DELF_INTERPRETER=\”/lib/ld-linux.so.2\” -DHB_EXPORT=Q_CORE_EXPORT -DQT_NO_DEBUG -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../mkspecs/qws/linux-arm-g++ -I. -I../../include -I../../include/QtCore -I.rcc/release-shared-emb-arm -Iglobal -I../3rdparty/zlib -I../3rdparty/harfbuzz/src -I../3rdparty/md5 -I../3rdparty/md4 -I.moc/release-shared-emb-arm -o .obj/release-shared-emb-arm/qabstractanimation.o animation/qabstractanimation.cpp

<command line>:156497025:62664: .pch/release-shared-emb-arm/QtCore:没有那个文件或目录

make[1]: *** [.obj/release-shared-emb-arm/qabstractanimation.o] 错误 1

make[1]:正在离开目录 `/home/sise/siseapp/qt_4.6.3_embedded_arm/qt-everywhere-opensource-src-4.6.3/src/corelib’

make: *** [sub-corelib-make_default-ordered] 错误 2

解决:
-pch 改成 -no-pch

sise@sise:~/siseapp/qt_4.6.3_embedded_arm/qt-everywhere-opensource-src-4.6.3$ ./configure -prefix /usr/local/Trolltech/QtEmbedded-4.6.3-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-qvfb -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

statemachine/qstatemachine.cpp: In constructor `

   QStateMachinePrivate::QStateMachinePrivate()’:

statemachine/qstatemachine.cpp:181: 错误: invalid pointer to bit-field `

   QAbstractStatePrivate::isMachine’

make[1]: *** [.obj/release-shared-emb-arm/qstatemachine.o] 错误 1

make[1]:正在离开目录 `/home/sise/siseapp/qt_4.6.3_embedded_arm/qt-everywhere-opensource-src-4.6.3/src/corelib’

make: *** [sub-corelib-make_default-ordered] 错误 2

解决:

注释QAbstractStatePrivate::isMachine

sise@sise:~/siseapp/qt_4.6.3_embedded_arm/qt-everywhere-opensource-src-4.6.3$ gedit mkspecs/qws/linux-arm-g++/qmake.conf

QMAKE_LINK              = arm-linux-g++

QMAKE_LINK_SHLIB        = arm-linux-g++

QMAKE_LINK              = arm-linux-g++ -lts

QMAKE_LINK_SHLIB        = arm-linux-g++ -lts

text/qfontengine_ft.cpp: In member function `bool

   QFontEngineFT::init(QFontEngine::FaceId, bool, QFontEngineFT::GlyphFormat)’:

text/qfontengine_ft.cpp:696: 警告: initialization to `int’ from `qreal’

text/qfontengine_ft.cpp:696: 警告: argument to `int’ from `qreal’

{standard input}: Assembler messages:

{standard input}:1599: Error: register or shift expression expected — `orr r3,r2,lsl#16′

{standard input}:1609: Error: register or shift expression expected — `orr r2,r3,lsl#16′

{standard input}:3151: Error: register or shift expression expected — `orr r2,r0,lsl#16′

{standard input}:3161: Error: register or shift expression expected — `orr r1,r0,lsl#16′

make[1]: *** [.obj/release-shared-emb-arm/qfontengine_ft.o] 错误 1

make[1]:正在离开目录 `/home/sise/siseapp/qt_4.6.3_embedded_arm/qt-everywhere-opensource-src-4.6.3/src/gui’

make: *** [sub-gui-make_default-ordered] 错误 2

解决:参考http://www.qtcn.org/bbs/read.php?tid=24692&fpage=0&toread=&page=1  守望者的临时解决方案:
To fix this issue patch /src/3rdparty/freetype/include/freetype/config/ftconfig.h Line 330.

(原来的为)  “orr %0, %2, lsl #16\n\t” /* %0 |= %2 << 16 */
(修改后为)  “orr %0, %0, %2, lsl #16\n\t” /* %0 |= %2 << 16 */

//     change this line

//    “orr    %0, %2, lsl #16\n\t”  /* %0 |= %2 << 16 */

      “orr    %0, %0,%2, lsl #16\n\t”  /* %0 |= %2 << 16 */

itemviews/qlistview.cpp

itemviews/qlistview.cpp: In member function `void

   QIconModeViewBase::doDynamicLayout(const QListViewLayoutInfo&)’:

itemviews/qlistview.cpp:2824: 错误: type specifier omitted for parameter `

   topLeft’

itemviews/qlistview.cpp:2886: 错误: no match for ‘operator|=’ in ‘

   rect(QPoint (*)()) |= QListViewItem::rect() const()’

itemviews/qlistview.cpp:2888: 错误: no match for ‘operator|=’ in ‘

   rect(QPoint (*)()) |= QRect(flowPosition, segPosition, deltaFlowPosition,

   deltaSegPosition)’

itemviews/qlistview.cpp:2890: 错误: no match for ‘operator|=’ in ‘

   rect(QPoint (*)()) |= QRect(segPosition, flowPosition, deltaSegPosition,

   deltaFlowPosition)’

itemviews/qlistview.cpp:2901: 错误: request for member `width’ in `

   rect(QPoint (*)())’, which is of non-aggregate type `QRect ()(QPoint (*)())’

itemviews/qlistview.cpp:2901: 错误: request for member `height’ in `

   rect(QPoint (*)())’, which is of non-aggregate type `QRect ()(QPoint (*)())’

itemviews/qlistview.cpp:2905: 错误: request for member `size’ in `

   rect(QPoint (*)())’, which is of non-aggregate type `QRect ()(QPoint (*)())’

itemviews/qlistview.cpp:2912: 错误: request for member `bottomRight’ in `

   rect(QPoint (*)())’, which is of non-aggregate type `QRect ()(QPoint (*)())’

make[1]: *** [.obj/release-shared-emb-arm/qlistview.o] 错误 1

make[1]:正在离开目录 `/home/sise/siseapp/qt_4.6.3_embedded_arm/qt-everywhere-opensource-src-4.6.3/src/gui’

make: *** [sub-gui-make_default-ordered] 错误 2

解决:

//               rect |= QRect(flowPosition, segPosition, deltaFlowPosition, deltaSegPosition);

            rect = rect | QRect(flowPosition, segPosition, deltaFlowPosition, deltaSegPosition);

2890

            else // flow == TopToBottom

 //               rect |= QRect(segPosition, flowPosition, deltaSegPosition, deltaFlowPosition);

            rect = rect | QRect(segPosition, flowPosition, deltaSegPosition, deltaFlowPosition);

不过修改后虽然可以编译通过,但是还是出现了更多的语法错误。这让我发现出现这些问题是不正常的。因为不同版本的gcc对语法检查的要求是不一样的,所以我直接换用了arm-linux-gcc 4.1.2,编译不会出现以上的错误。

编译完成后,安装,在qcreator中建立该版本的qt环境变量。

 

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
qt-embedded-linux-opensource-src-4.5.1成功移植到micro2440
编译安装tslib1.4
成功移植Qt4.7到2440,失败是被误导
Qt4.8.3移植总结
Qt-embedded-linux移植要点Qt
qt-embedded-linux-opensource-src-4.5.3移植
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服