ubuntu10.10建立QT开发环境

ubuntu10.10建立QT开发环境


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

sudoapt-get install g++


二、安装arm-linux-gcc3.3.2

建立arm-linux交叉工具链crosstool-ng

http://blog.csdn.net/chen_zhongming/article/details/6680596

win7下,ubuntu11.10 (虚拟机)搭建交叉编译环境

http://topic.csdn.net/u/20111211/12/36be1ffa-7145-45a1-9923-4562857a3526.html

http://www.arm9.net/download-arm-linux-gcc-4.3.2.asp

arm-linux-gcc-4.3.2withEABI

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

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)添加交叉编译工具链环境变量

方法一:

建立环境变量设置脚本:

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

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


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

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

exportPATH=/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,需要安装以下的文件:

提示内容:

Apartfrom a C++ compiler, a number of development libraries need to bepresent to enable Qt Creator to build your Qt applications. On Debianand Ubuntu, use the following command in a terminal to make sure theyare installed:


sudoapt-get install libglib2.0-dev libSM-dev libxrender-devlibfontconfig1-dev libxext-dev


Ifyou're using QtOpenGL, you'll also need OpenGL development files. Youcan use the following command to find out which packages to install:


sudoapt-get install libgl-dev libglu-dev


3)安装libgl-devlibglu-dev包:

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

4)安装libgl-devlibglu-dev包:

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

提示没有libgl-dev

5)安装libgl1-mesa-devlibglu-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>


intmain(int argc,char* argv[])

{

QApplicationapp(argc,argv);

QLabel*label = new QLabel("hello world");

label->show();

returnapp.exec();

}


编译


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


8)编译qvfb

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

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

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

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

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

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

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

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

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

这是由于系统缺少gluixorg库,安装gluixorg库:

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

exportPATH=/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

4)安装

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

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

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

打开helloworld工程:

选择该版本qt的环境变量

设置runsetting

我们先打开qvfb

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

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

///葛林/(按照以下成功安装)

五、编译安装tslib

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


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

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

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

2)注:此步需要一些工具,ubuntu下需要安装automakeautoconflibtool,可以执行下面语句安装,sudoapt-get install automakeautoconf 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-linuxac_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_rawinput”注释去掉,变为module_rawinput”,注意一定要顶格。


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

打开profile

$vi/etc/profile

添加内容如下:

exportTSLIB_ROOT=/tslib
export TSLIB_TSDEVICE=/dev/event0
exportLD_LIBRARY_PATH=/tslib/lib:$LD_LIBRARY_PATH
exportTSLIB_FBDEVICE=/dev/fb0
exportTSLIB_PLUGINDIR=/tslib/lib/ts
exportTSLIB_CONSOLEDEVICE=none
exportTSLIB_CONFFILE=/tslib/etc/ts.conf
exportTSLIB_CALIBFILE=/etc/pointercal
exportTSLIB_TSEVENTTYPE="H3600"
export QWS_SIZE=320*240
exportQWS_MOUSE_PROTO=Tslib:/dev/event0
exportQWS_DISPLAY="LinuxFb:mmWidth50:mmHeight65:0"
exportPOINTERCAL_FILE=/etc/pointercal
export QWS_SW_CURSOR
exportQWS_KEYBOARD="TTY:/dev/tty1"

export setQTDIR=/opt/qt
export PATH=$QTDIR:$PATH
exportLD_LIBRARY_PATH=$QTDIR/lib:$QTDIR/plugins/imageformats:$LD_LIBRARY_PATH
exportQT_PLUGIN_PATH=$QTDIR/plugins/
exportQT_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]


[additionalplatform specific options (see below)]



Installationoptions:


Theseare 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" installationof

Qt.This will install into

/usr/local/Trolltech/Qt-4.6.3, ifthis option is

disabledthen some platforms will attempt a

"system"install by placing default values to

beplaced in a system location other than

PREFIX.


Youmay use these to separate different parts of the install:


-bindir<dir> ......... Executables will be installed to <dir>

(defaultPREFIX/bin)

-libdir<dir> ......... Libraries will be installed to <dir>

(defaultPREFIX/lib)

-docdir<dir> ......... Documentation will be installed to <dir>

(defaultPREFIX/doc)

-headerdir<dir> ...... Headers will be installed to <dir>

(defaultPREFIX/include)

-plugindir<dir> ...... Plugins will be installed to <dir>

(defaultPREFIX/plugins)

-datadir<dir> ........ Data used by Qt programs will be installed to<dir>

(defaultPREFIX)

-translationdir<dir> . Translations of Qt programs will be installed to <dir>

(defaultPREFIX/translations)

-sysconfdir<dir> ..... Settings used by Qt programs will be looked for in<dir>

(defaultPREFIX/etc/settings)

-examplesdir<dir> .... Examples will be installed to <dir>

(defaultPREFIX/examples)

-demosdir<dir> ....... Demos will be installed to <dir>

(defaultPREFIX/demos)


Youmay 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

loadthose that have a matching key.


Configureoptions:


Thedefaults (*) are usually acceptable. A plus (+) denotes a defaultvalue

thatneeds 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

debuggingturned on (Mac only).


-developer-build... Compile and link Qt with Qt developer options (includingauto-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 Makefilesfor all

projectfiles.

-fast.............. Configure Qt quickly by generating Makefiles only for

libraryand subdirectory targets. All other Makefiles

arecreated 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

noneare turned on.

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

atrun time.


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

QtXmlPatternsis built if a decent C++ compiler

isused 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 intoQtMultimedia if available.


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

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

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

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


-platformtarget ... The operating system and compiler you are building

on(linux-g++).


Seethe README file for a list of supported

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


ThirdParty Libraries:


-qt-zlib........... Use the zlib bundled with Qt.

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

Seehttp://www.gzip.org/zlib


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

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

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

Seehttp://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.

Seehttp://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.

Seehttp://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.

Seehttp://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.)


Additionaloptions:


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

(libstools 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 theQt

libraries.

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


-no-rpath.......... Do not use the library install path as a runtime

librarypath.

+ -rpath ............. Link Qt libraries and executables using thelibrary

installpath 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

configureprocess.


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

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

Requirescups/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 loadlibdbus-1.

-dbus-linked....... Compile the QtDBus module and link to libdbus-1.


-reduce-relocations..... Reduce relocations in the libraries through extra

linkeroptimizations (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/X11only:


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

Seehttp://radscan.com/nas.html


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

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

Withno parameter, this will auto-detect the "best"

OpenGLAPI to use. If desktop OpenGL is available, it

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

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

OpenGLES 1.x Common profile, 1.x Common Lite profile

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

tomanage GL contexts in the case of OpenGL ES


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

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

RequiresEGL support, typically supplied by an OpenGL

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

RequiresX11/extensions/shape.h.


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

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

RequiresX11/extensions/sync.h.


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

* -xinerama .......... Compile Xinerama support.

RequiresX11/extensions/Xinerama.h and libXinerama.

By default, Xinerama support will be compiled if

availableand the shared libraries are dynamically

loadedat runtime.


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

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

RequiresX11/Xcursor/Xcursor.h and libXcursor.

By default, Xcursor support will be compiled if

availableand the shared libraries are dynamically

loadedat runtime.


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

* -xfixes ............ Compile Xfixes support.

RequiresX11/extensions/Xfixes.h and libXfixes.

By default, Xfixes support will be compiled if

availableand the shared libraries are dynamically

loadedat runtime.


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

* -xrandr ............ Compile Xrandr support.

RequiresX11/extensions/Xrandr.h and libXrandr.


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

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

RequiresX11/extensions/Xrender.h and libXrender.


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

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

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


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

* -fontconfig ........ Compile FontConfig support.

Requiresfontconfig/fontconfig.h, libfontconfig,

freetype.hand libfreetype.


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

* -xinput ............ Compile Xinput support. This also enabled tabletsupport

whichrequires IRIX with wacom.h and libXi or

XFree86with 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


编译完成后执行:makeinstall安装!


然后:在QTCreator 的工具栏->选项->构建和运行 ->QT版本->手动添加

/usr/local/Trolltech/QtEmbedded-4.6.3-arm/bin/qmake

然后清楚原工程 文件编译;重新构建。

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


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.oanimation/qabstractanimation.cpp

<commandline>: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:错误: invalidpointer 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:警告: initializationto `int' from `qreal'

text/qfontengine_ft.cpp:696:警告: argumentto `int' from `qreal'

{standardinput}: Assembler messages:

{standardinput}:1599: Error: register or shift expression expected -- `orrr3,r2,lsl#16'

{standardinput}:1609: Error: register or shift expression expected -- `orrr2,r3,lsl#16'

{standardinput}:3151: Error: register or shift expression expected -- `orrr2,r0,lsl#16'

{standardinput}:3161: Error: register or shift expression expected -- `orrr1,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 守望者的临时解决方案:
Tofix this issue patch/src/3rdparty/freetype/include/freetype/config/ftconfig.h Line330.

(原来的为) "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(constQListViewLayoutInfo&)':

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

topLeft'

itemviews/qlistview.cpp:2886:错误: nomatch for 'operator|=' in '

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

itemviews/qlistview.cpp:2888:错误: nomatch for 'operator|=' in '

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

deltaSegPosition)'

itemviews/qlistview.cpp:2890:错误: nomatch for 'operator|=' in '

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

deltaFlowPosition)'

itemviews/qlistview.cpp:2901:错误: requestfor member `width' in `

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

itemviews/qlistview.cpp:2901:错误: requestfor member `height' in `

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

itemviews/qlistview.cpp:2905:错误: requestfor member `size' in `

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

itemviews/qlistview.cpp:2912:错误: requestfor 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-gcc4.1.2,编译不会出现以上的错误。


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





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值