64位centOS 5.3下安装配置Nokia Qt开发环境
December 4, 2009 – 2:55 amNokia推出了Qt 4.6,按照官方说的,代码一次编写,到处编译执行。尤其可以在诺基亚本家的symbian和maemo上运行,这倒是很诱惑人呢!Qt 4.6兼容symbian,还有webkit支持,看来尝试一下是很有必要的,前些日子买了一本C++ Qt Ui的书,这些日子看来又有的忙了… …
本文测试环境为centOS 5.3 x86_64,其他操作系统安装Qt SDK都没有centOS这么费劲,汗!
首先下载Nokia Qt SDK并安装
下载地址:http://qt.nokia.com/downloads/sdk-linux-x11-64bit-cpp
- chmod u+x qt-sdk-linux-x86_64-opensource-2009.05.bin
- ./qt-sdk-linux-x86_64-opensource-2009.05.bin
安装完毕后创建一个Qt gui项目,随便加个label然后编译看看。
编译报错如下:
- No valid Qt version set. Set one in Tools/Options
- Error while building project helloworld
- When executing build step 'QMake'
- Canceled build.
解决方法,依次选择tools->options->Qt4->qt versions,新加一个Qt versions,如图所示:

点击OK,再次编译。
这次编译报错如下:
- /home/program/qtsdk-2009.05/qt/lib/libQtGui.so: undefined reference to `FcFreeTypeQueryFace'
- collect2: ld returned 1 exit status
- make: Leaving directory `/home/project/qt/helloworld/helloworld'
- make: *** [helloworld] Error 1
- Exited with code 2.
- Error while building project helloworld
- When executing build step 'Make'
解决方法,首先备份/usr/lib下的libfontconfig.so.1和libfontconfig.so.1.1.0两个文件,否则后面编译安装fontconfig后你会发现电脑上装的skype不能用了。
下载fontconfig,下载地址:http://fontconfig.org/release/
- tar zxvf fontconfig-2.8.0.tar.gz
- cd fontconfig-2.8.0
- ./configure --prefix=/usr
一般会提示错误如下:
- checking for LIBXML2... configure: error: Package requirements (libxml-2.0 >= 2.6) were not met:
- No package 'libxml-2.0' found
- Consider adjusting the PKG_CONFIG_PATH environment variable if you
- installed software in a non-standard prefix.
- Alternatively, you may set the environment variables LIBXML2_CFLAGS
- and LIBXML2_LIBS to avoid the need to call pkg-config.
- See the pkg-config man page for more details.
解决方法:
- yum install libxml2-devel
安装好后再次
- ./configure --prefix=/usr
然后继续
- make
- make install
即可
此时把/usr/lib里刚编译好的5个文件linfontconfig.a,linfontconfig.la,linfontconfig.so,linfontconfig.so.1,linfontconfig.so.1.4.4都拷贝到/usr/lib64里,当然提前把lib64里的文件做个备份是好习惯。
此时打开QtCreator编译一下刚才的helloworld,成功了,如图:

此时启动一下skype看看,报错如下:
- ./skype: error while loading shared libraries: libfontconfig.so.1: wrong ELF class: ELFCLASS64
原因在于skype访问了32位库,而32位库被我们刚才编译安装fontconfig时替换成了最新的64位库,这个时候把前面备份好的libfontconfig.so.1和libfontconfig.so.1.1.0两个文件拷贝到/usr/lib就可以成功启动skype了。