转载注明出处:袁方的技术博客 http://blog.csdn.net/yf210yf
【目标板】ICETEK-OMAPL138-KB
【安装源】
(1) Qt_SDK_Lin32_offline_v1_1_2_en.run
http://qt.nokia.com/downloads/sdk-linux-x11-32bit-cpp-offline
(2) qt-everywhere-opensource-src-4.7.3.tar.gz
http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.3.tar.gz
(3) tslib1.4.tar.gz
(4) arm-linux-gcc 4.3.2
前提tslib1.4已经编译安装完成,具体方法看另篇博文。
步骤:
(1)将qt-everywhere-opensource-src-4.7.3.tar.gz解压到指定目录
(2)终端cd进入qt-everywhere-opensource-src-4.7.3.tar.gz解压目录
(3)配置
# ./configure -prefix /opt/QtEmbedded-4.7.3 -release -shared -fast -pch -no-qt3support -qt-sql-sqlite -no-libtiff -no-libmng -qt-libjpeg -qt-zlib -qt-libpng -qt-freetype -no-openssl -nomake examples -nomake demos -nomake tools -optimized-qmake -no-phonon -no-nis -no-opengl -no-cups -no-xcursor -no-xfixes -no-xrandr -no-xrender -no-xkb -no-sm -no-xinerama -no-xshape -no-separate-debug-info -xplatform qws/linux-arm-g++ -embedded arm -depths 16 -no-qvfb -qt-gfx-linuxfb -no-gfx-qvfb -no-kbd-qvfb -no-mouse-qvfb -confirm-license -qt-mouse-tslib -I/opt/tslib/include -L/opt/tslib/lib
备注:
最后3句是指定使用触摸屏,并制定tslib1.4的安装目录的头文件以及库函数。我的tslib是安装在opt下。
(4)make
(5)make install
至此arm版的qt4.7.3安装完毕,在arm板上跑qt的支持文件为/opt/QtEmbedded-4.7.3,将整个文件夹拷贝到arm板的文件系统的相应位置下即可。
(6)装qt SDK,将Qt_SDK_Lin32_offline_v1_1_2_en.run拷贝到指定目录,并进入目录执行
chmod u+x Qt_SDK_Lin32_offline_v1_1_2_en.run
./Qt_SDK_Lin32_offline_v1_1_2_en.run
即可安装qt开发的SDK
(7)新建一个最简单的窗口程序
剩下使用默认配置,点击下一步即可。
至此arm编译环境的配置完成,我们可以重新构建工程,生成可执行文件,把此文件拷贝到开发板的文件系统,即可运行了!
附录:
【配置说明】
当进入解压好的源码包后,使用./configure –help命令,可以获得相应帮助
#./configure –help
Usage: configure [-h] [-prefix
-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 GIF reading support.
* -qt-gif ............ Compile GIF reading support.
See also src/gui/image/qgifhandler_p.h
-no-libtiff ........ Do not compile 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 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 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 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
(libs tools examples demos docs translations)
-nomake
-R
libraries.
-l
-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-gui ............ Don't build the Qt GUI library
-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
-egl ............... Use EGL instead of GLX to manage contexts.
When building for desktop OpenGL, this option will
make Qt use EGL to manage contexts rather than the
GLX, which is the default. Note: For OpenGL ES, EGL
is always used.
-no-opengl ......... Do not support OpenGL.
+ -opengl
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, or es2 for
to force the use of the Desktop (OpenGL 1.x or 2.x),
OpenGL ES 1.x Common profile, or 2.x APIs instead.
-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-xvideo ......... Do not compile XVideo support.
* -xvideo ............ Compile XVideo support.
Requires X11/extensions/Xv.h & Xvlib.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.
-release
这个参数显而易见,就是编译Qt以发布版的模式进行,一般来说,最后系统完成后,库就应该是发布版。
-debug
调试版
-developer-build
选了这个后,可以进行自动测试
-opensource
-commercial
这两个参数是指是编译是商业版本的,还是开源版本呢,视个人情况而定。
-shared
-static
这两个参数是指Qt的lib以动态还是静态编译生成,这自然也是视个人需要的。
-no-fast
-fast
这两个就很有关系,如果对自己的电脑性能很有信心,那就选第一个,那所有的工程文件都会生成到makefiles中,那编译的时间,估计可以看完变形金刚了。如果选第二个,那就加入子目录和库到makefiles,这样就能加快编译的速度。
-no-largefile
-largefile
顾名思义,支不支持大文件,一般来说,嵌入式里是不会有从超过4G的大文件的,那就选第一个吧。
-no-exceptions
-exceptions
异常情况,选则编译器支持抛出异常,否则不支持。
-no-accessibility
-accessibility
可访问性的支持
-no-stl
-stl
是都加入stl的支持,stl,这应该算是C++程序员应该都了解了,再不济,那也总听说过大名吧。
no-sql-
-qt-sql-
-plugin-sql-
一般来说,对于一个优秀的项目开发,数据库是必不可少的,qt也自带了大多数数据库驱动,可以完美地支持数据库的使用。对于数据库的使用,我们可以直接qt驱动编译进去,或者以插件的形式编译进去。一般来说,最简单地就是直接编译进去,但使用插件形式的可以更加灵活,针对不同的需求将驱动插件添加。其中,<>代表的是驱动名,如果我想直接添加sqlite的支持话,形式如下:-qt-sql-sqlite。其他名称可以自己查看参数里,有详细地介绍。
-system-sqlite
这个参数意思是使用操作系统上的sqlite数据库,如果是不太会移植的,可以考虑直接使用qt自带的驱动。
-no-qt3support
-qt3support
加不加对qt3的支持。
no-xmlpatterns
-xmlpatterns
选择对xml的支持,如果对网络无需求的话,就不用加了。
-no-phonon
-phonon
phonon是qt中处理多媒体的模块-no-phonon-backend
-phonon-backend
与上面类似,只不过这两是以插件的形式加入支持。
-no-svg
-svg
是否加入svg的支持,svg即可缩放矢量图形。
-no-webkit
-webkit
是否加入webkit的支持,这可是个好东西,不过如果跟网络不搭界的话,还是不支持吧。
-no-scripttools
-scripttools
是否加入脚本工具的支持
-platform target
目标平台,这可是关键了,如果不注意的话,编译出来是x86上的话,哪怕是再牛的嵌入式工程师来也没法帮你移植到开发板上。通常,是linux-arm-g++。
-no-mmx
-no-3dnow
-no-sse
-no-sse2
这四个参数是针对CPU的指令集
-qtnamespace
把qt的库封装到命名空间
-qtlibinfix
将所有的qt的.so库重命名