配置Qt/X11安装包

来源:互联网 发布:西部数据域名注册 编辑:程序博客网 时间:2024/05/16 14:45

 

      一些朋友在安装Qt开发包的时时候总是对一些安装的配置感到迷惑,一般情况下,只需要执行:

[root@02486 qt-x11-opensource-src-4.2.3]# ./configure

就可以了,一般的默认配置对我们的开发来说就够了,在执行./configure命令时,会将你指定的一些配置,在安装包的源代码目录生成相应的.pro文件,以决定支持什么样的功能,是否支持什么,你可以通过执行

[root@02486 qt-x11-opensource-src-4.2.3]# ./configure  -help

命令来获取相应的配置选项。

      下面我对一些配置选项做了一点注释,因为英语水平比较烂,错误再所难免,请指出,我们的目的只是通过这篇文档帮助更多的人获取相应的信息。

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] [-no-zlib]
        [-Qt-zlib] [-system-zlib] [-no-gif] [-Qt-gif] [-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-qdbus] [-qdbus] [-no-separate-debug-info]
        [-separate-debug-info]         

安装选项:

这些配置选项是可选的,你可以根据需要来决定是否进行配置,下面一些选项你可以用来指定安装目录。

选项

注释

-prefix <dir>

.安装所有Qt相关的文件到这个目录<dir> 缺省为: /usr/local/Trolltech/Qt-4.2.3

*-prefix-install

强制将Qt安装至“local”目录,
如:
/user/local/Trolltech/Qt-4.2.3,如果这项被禁止的话,那么有些平台将会把Qt默认安装到system位置

 

你可以使用下列选项来配置Qt各个部分的安装目录:

选项

注释

-bindir <dir>

指定可执行文件安装所在的目录<dir>,(默认为PREFIX/bin

-libdir <dir>

指定库文件安装所在目录<dir>,(默认为PREFIX/lib

-docdir <dir>

指定帮助文档安装所在目录 <dir>,(默认为PREFIX/doc

-headerdir <dir>

指定头文件安装所在目录 <dir>(默认为PREFIX/include

-plugindir <dir>

指定插件文件安装所在目录 <dir>(默认为PREFIX/plugins

-datadir <dir>

Qt程序所使用的数据文件所在目录<dir>(默认为PREFIX

-translationdir <dir>

Qt程序的翻译文件所在目录<dir>
(默认为
PREFIX/translations

-sysconfdir <dir>

Qt的相关设置文件所在目录<dir>
(默认为
PREFIX/etc/settings

-examplesdir <dir>

例子程序所在目录<dir>(默认为PREFIX/examples

-demosdir <dir>

演示文件所在目录<dir>,(默认为PREFIX/demos

 

你可以使用下列选项来限制插件的加载。

选项

注释

-buildkey <key>

使用指定的<key>来生存Qt库和插件。当这个库加载插件时,它将只能加载那些和key相匹配的插件。

 

配置选项:

*)表示缺省情况下已接受的项。加号(+)表示这个缺省值需要进行评估,如果成功评估,那么新的Qt开发环境将会包含这个特性。下面简单介绍一下每一个选项:

 

 

 *  -release ........... 以发行版而非调试版来编译Qt开发工具及相应库。
    -debug .............
以调试版本来编译Qt开发工具及相应库。
    -debug-and-release .
编译兼容发行版及调试版的Qt开发工具及相应的库。

 *  -shared ............ 所编译用来开发的Qt库及Qt开发工具的库是动态库,比如Qt库为libqt.so
    -static    ............
编译用来开发的Qt库是静态库,以后在开发人员使用时也是用的Qt的静态库。

 *  -no-fast ...........对所有的project文件都生成Makefile文件,正常地配置Qt
    -fast    ..............
通过只对库文件及子目录目标生成Makefile文件来快速配置Qt。所有其它的Makefile文件被组装成一个可以用qmake来运行的包。

    -no-largefile.......禁止大文件支持。
 +  -largefile ..........
允许Qt访问大于4GB的文件。

    -no-exceptions .....禁止编译器支持异常处理。
 *  -exceptions  ........
允许编译器支持异常处理。

    -no-accessibility ..不编译可访问性支持。
 *  -accessibility  .....
编译可访问性支持。

    -no-stl ............不编译支持STL
 *  -stl  ...............
编译支持STL

    -no-sql-<driver>      ...完全禁止SQL <driver>
    -Qt-sql-<driver>      ...
允许QtSql库中的SQL<driver>,默认是没有打开。
    -plugin-sql-<driver>
  允许SQL<driver>在运行时以一个插件的形式被链接上。
                                      <driver>
的可能值为:
                                      [ibase mysql odbc psql sqlite sqlite2 ]

    -system-sqlite .....使用操作系统的sqlite

    -no-Qt3support .....禁止Qt3支持的功能。注:如果你选择此项,你将无法从Qt3移植到Qt4
 *  -Qt3support  ........
允许Qt3支持的功能。

    -platform target ...你所使用的操作系统及编译器。具体可参考README文件中的操作系统及编译器列表。

    -D <string> ........新增预处理宏定义。
    -I <string> ........
新增include路径。
    -L <string> ........
新增库文件路径。

-help, -h ..........显示帮助信息。

 

第三方库:

    -no-zlib ...........不编译ZLIB支持。与-no-libpng意思相同。
    -Qt-zlib ...........
使用zlibQt捆绑。即将zlib编入进libqt库中。
 +  -system-zlib .......
从操作系统中来使用zlib, http://www.gzip.org/zlib <zlib是用于无损数据压缩的库>

 *  -no-gif .............不编译GIF读支持的插件。
    -Qt-gif ............
编译GIF读支持的插件。 参考src/plugins/imageformats/gif/qgifhandler.h

    -no-libpng .........不编译PNG支持。
    -Qt-libpng .........
使用libpngQt捆绑。即将libpng编入libqt库中。
 +  -system-libpng .....
使用操作系统的libpng http://www.libpng.org/pub/png PNG Portable Network Graphics 是一种存贮计算机位图图像的一种格式.

    -no-libmng .........不编译MNG支持。
    -Qt-libmng .........
使用libmngQt捆绑。即将libmng编入libqt库中。
 +  -system-libmng .....
使用操作系统的libmng http://www.libmng.com  MNGMultiple-image Network Graphics),相当于动态的PNG

    -no-libjpeg ........不编译支持JPEG的插件。
    -Qt-libjpeg ........
使libjpegQt捆绑。即将libjpeg编入libqt库中。
 +  -system-libjpeg ....
使用操作系统的libjpeg  http://www.ijg.org

附加选项:

    -make <part> .......make的时候,加入组件<part>到组件列表中,以便于进行build构建。
    -nomake <part> .....
从当前的组件列表中排除指定的组件<part>

    -R <string> .........新增一个明确的运行时库路径到Qt的库列表中。
    -l <string> ........
新增一个明确的库。

    -no-rpath ..........不以运行时库路径的形式使用库的安装路径。
 +  -rpath .............
以运行时库路径的形式使用库的安装路径。其等价于-R <库安装路径>

    -continue...........在错误发生的时候,尽可能地继续运行。

    -verbose, -v .......在配置的过程中,对每一步都打印出详细的信息。

    -silent ............减少构建的输出信息,这样,便于更清楚地看到警告和错误信息。

    -no-nis ............不编译NIS支持。
 *  -nis ...............
编译NIS支持。

    -no-cups............不编译CUPS支持。
 *  -cups ..............
编译CUPS支持。

    -no-iconv...........不编译对iconv3)的支持。
 *  -iconv..............
编译对iconv3)的支持。

 *  -no-pch ............不使用预编译头文件支持。
    -pch ...............
使用预编译头文件支持。

    -no-qdbus...........不编译著QtDBus模块。
 +  -qdbus..............
编译著QtDBus模块。

    -no-separate-debug-info不会单独用文件来保存调试信息。
 *  -separate-debug-info   
将调试信息单独剥离出来,保存到.debug文件中。

 

仅用于Qt/X11的选项:

 *  -no-nas-sound   ......不编译NAS音频的支持。
    -system-nas-sound ..
使用操作系统的NAS libaudio库文件。 http://radscan.com/nas.html
 
    -no-opengl..........
不支持OpenGL
 +  -openg l.............
允许支持OpenGL

    -no-sm .............不支持X会话管理。
 *  -sm . ...............
支持X会话管理,连接-lSM -lICE

    -no-xshape .........不编译XShape支持。
 *  -xshape  ............
编译XShape支持。需要X11/extensions/shape.h.

    -no-xinerama .......不编译Xinerama(多线程)支持。
 *  -xinerama  ..........
编译Xinerama支持。需要X11/extensions/Xinerama.h and libXinerama.

    -no-xcursor ........不编译Xcursor支持。
 *  -xcursor  ...........
编译Xcursor支持。需要X11/Xcursor/Xcursor.h and libXcursor.

    -no-xfixes .........不编译Xfixes支持。
 *  -xfixes  ............
编译Xfixes支持。需要X11/extensions/Xfixes.h and libXfixes.

    -no-xrandr .........不编译Xrandr(调整大小及旋转)的支持。
 *  -xrandr  ............
编译Xrandr的支持。需要X11/extensions/Xrandr.h and libXrandr.

    -no-xrender ........不编译Xrender的支持。
 *  -xrender ...........
编译Xrender的支持。需要X11/extensions/Xrender.hlibXrender

    -no-fontconfig .....不编译FontConfig支持。
 *  -fontconfig ........
编译FontConfig支持。需要fontconfig/fontconfig.h, libfontconfig, freetype.hlibfreetype.

    -no-tablet .........不编译Tablet支持。
 *  -tablet  ............
编译Tablet支持。需要IRIX带有wacom.h libXi ,或者XFree86 X11/extensions/XInput.h libXi

    -no-xkb ............不编译XKBX键盘扩展)支持。
 *  -xkb  ...............
编译XKB支持。

    -no-glib............不编译Glib支持。
 +  -glib ...............
编译Glib支持。

 

 

做完配置时,你可以看到屏幕会打出这样的信息:

        This target is using the GNU C++ compiler (linux-g++).

        Recent versions of this compiler automatically include code for
        exceptions, which increase both the size of the Qt libraries and
        the amount of memory taken by your applications.

        You may choose to re-run configure with the -no-exceptions
        option to compile Qt without exceptions. This is completely binary
        compatible, and existing applications will continue to work.

 

Build type:    linux-g++
Architecture:  i386
Platform notes:

            - Also available for Linux: linux-kcc linux-icc linux-cxx
       
Build ............... libs tools examples
Configuration .......  release shared dll largefile stl separate_debug_info sse  qt3support accessibility opengl minimal-config small-config medium-config large-config full-config ipv6 getaddrinfo ipv6ifname getifaddrs system-jpeg system-png png gif system-freetype system-zlib nis cups iconv glib nas x11sm xshape xinerama xcursor xfixes xrandr xrender fontconfig tablet xkb release

Debug................ no
Qt 3 compatibility... yes
QtDBus module........ no
STL support ......... yes
PCH support ......... no
MMX/SSE support ..... yes
IPv6 support ........ yes
IPv6 ifname support . yes
getaddrinfo support . yes
getifaddrs support... yes
Accessibility ....... yes
NIS support ......... yes
CUPS support ........ yes
Iconv support ....... yes
Glib support ........ yes
Large File support .. yes
GIF support ......... yes
JPEG support ........ plugin (system)
PNG support ......... yes (system)
MNG support ......... plugin (qt)
zlib support ........ system
OpenGL support ...... yes
NAS sound support ... system
Session management .. yes
XShape support ...... yes
Xinerama support .... yes
Xcursor support ..... yes
Xfixes support ...... yes
Xrandr support ...... yes
Xrender support ..... yes
FontConfig support .. yes
XKB Support ......... yes
immodule support .... yes
SQLite support ...... plugin (qt)

你可以对照你所进行配置选项,看是否一致,要这段信息之后,接着打出的信息,将会告诉你生成了哪些.pro文件,也就是说,再你后面所要编译Qt开发环境或Qt开发的库所执行gmake命令将会调用到的.pro文件,它将编译对应的源代码,以获得你所期望的开发环境。

如果你想在相同的目录下重新配置和编译Qt开发工具,即对先前的配置不是十分满意,或者先前的配置有错误的地方,你可以通过执行命令make confclean将原来的配置好的一些文件(如用于编译Qt开发环境的.pro文件和Makefile文件)进行移除,然后再次执行./configure命令来重新进行配置。

[root@02486 qt-x11-opensource-src-4.2.3]# make confclean
cd src && make -f Makefile clean
make[1]: Entering directory `/home/erizhang/tools/qt-x11-opensource-src-4.2.3/src'
cd tools/moc && make -f Makefile clean
make[2]: Entering directory `/home/erizhang/tools/qt-x11-opensource-src-4.2.3/src/tools/moc'
rm -f qmake_image_collection.cpp
rm -f release-shared/moc.o release-shared/preprocessor.o release-shared/main.o release-shared/generator.o release-shared/parser
.o release-shared/token.o release-shared/qglobal.o release-shared/qbuffer.o release-shared/qdir.o release-shared/qfile.o releas
e-shared/qfileinfo.o release-shared/qfsfileengine.o release-shared/qiodevice.o release-shared/qtemporaryfile.o release-shared/q
textstream.o release-shared/qmetatype.o release-shared/qbytearraymatcher.o release-shared/qchar.o release-shared/qdatetime.o re
lease-shared/qhash.o release-shared/qlistdata.o release-shared/qlocale.o release-shared/qmap.o release-shared/qstring.o release
-shared/qstringlist.o release-shared/qstringmatcher.o release-shared/qvector.o release-shared/qabstractfileengine.o release-sha
red/qbytearray.o release-shared/qunicodetables.o release-shared/qvsnprintf.o release-shared/qfsfileengine_unix.o
rm -f *~ core *.core
make[2]: Leaving directory `/home/erizhang/tools/qt-x11-opensource-src-4.2.3/src/tools/moc'
cd tools/rcc && make -f Makefile clean

.......

make[1]: Leaving directory `/home/erizhang/tools/qt-x11-opensource-src-4.2.3/config.tests/x11/sm'
make[1]: Entering directory `/home/erizhang/tools/qt-x11-opensource-src-4.2.3/config.tests/x11/xshape'
rm -f qmake_image_collection.cpp
rm -f xshape.o
rm -f *~ core *.core
rm -f xshape
rm -f Makefile
make[1]: Leaving directory `/home/erizhang/tools/qt-x11-opensource-src-4.2.3/config.tests/x11/xshape'
make[1]: Entering directory `/home/erizhang/tools/qt-x11-opensource-src-4.2.3/config.tests/x11/opengl'
rm -f qmake_image_collection.cpp
rm -f opengl.o
rm -f *~ core *.core
rm -f opengl
rm -f Makefile
make[1]: Leaving directory `/home/erizhang/tools/qt-x11-opensource-src-4.2.3/config.tests/x11/opengl'
make[1]: Entering directory `/home/erizhang/tools/qt-x11-opensource-src-4.2.3/qmake'
rm -f project.o property.o main.o makefile.o unixmake2.o unixmake.o mingw_make.o option.o winmakefile.o projectgenerator.o meta.o md
5.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o  qchar.o qstring.o qstringmatcher.o qtextstream.o qiodevice.o qglobal.o
 qbytearray.o qbytearraymatcher.o qdatastream.o qbuffer.o qlistdata.o qfile.o qfsfileengine_unix.o qfsfileengine.o qregexp.o qvector
.o qbitarray.o qdir.o quuid.o qhash.o qfileinfo.o qdatetime.o qstringlist.o qabstractfileengine.o qtemporaryfile.o qmap.o qunicodeta
bles.o qmetatype.o qsettings.o qlibraryinfo.o qvariant.o qvsnprintf.o qlocale.o qlinkedlist.o qurl.o
rm -rf /home/erizhang/tools/qt-x11-opensource-src-4.2.3/bin/qmake .deps
make[1]: Leaving directory `/home/erizhang/tools/qt-x11-opensource-src-4.2.3/qmake'
~


[root@02486 qt-x11-opensource-src-4.2.3]# ./configure

      这样你就可以放心大胆的去试了,因为试错了,也有make confclean这个原悔药可吃,呵呵。

      好了,相信你对Qt安装包的配置已经有了一定的了解了,接下来要做的事就是试着做一遍,Qt安装的步骤可以参考:Qt-X11

 
原创粉丝点击