64位centOS 5.3下安装配置Nokia Qt开发环境

December 4, 2009 – 2:55 am

Nokia推出了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

  1. chmod u+x qt-sdk-linux-x86_64-opensource-2009.05.bin
  2. ./qt-sdk-linux-x86_64-opensource-2009.05.bin

安装完毕后创建一个Qt gui项目,随便加个label然后编译看看。
编译报错如下:

  1. No valid Qt version set. Set one in Tools/Options
  2. Error while building project helloworld
  3. When executing build step 'QMake'
  4. Canceled build.

解决方法,依次选择tools->options->Qt4->qt versions,新加一个Qt versions,如图所示:
set Qt creator versions
点击OK,再次编译。
这次编译报错如下:

  1. /home/program/qtsdk-2009.05/qt/lib/libQtGui.so: undefined reference to `FcFreeTypeQueryFace'
  2. collect2: ld returned 1 exit status
  3. make: Leaving directory `/home/project/qt/helloworld/helloworld'
  4. make: *** [helloworld] Error 1
  5. Exited with code 2.
  6. Error while building project helloworld
  7. When executing build step 'Make'

解决方法,首先备份/usr/lib下的libfontconfig.so.1和libfontconfig.so.1.1.0两个文件,否则后面编译安装fontconfig后你会发现电脑上装的skype不能用了。
下载fontconfig,下载地址:http://fontconfig.org/release/

  1. tar zxvf fontconfig-2.8.0.tar.gz
  2. cd fontconfig-2.8.0
  3. ./configure --prefix=/usr

一般会提示错误如下:

  1. checking for LIBXML2... configure: error: Package requirements (libxml-2.0 >= 2.6) were not met:
  2.  
  3. No package 'libxml-2.0' found
  4.  
  5. Consider adjusting the PKG_CONFIG_PATH environment variable if you
  6. installed software in a non-standard prefix.
  7.  
  8. Alternatively, you may set the environment variables LIBXML2_CFLAGS
  9. and LIBXML2_LIBS to avoid the need to call pkg-config.
  10. See the pkg-config man page for more details.

解决方法:

  1. yum install libxml2-devel

安装好后再次

  1. ./configure --prefix=/usr

然后继续

  1. make
  2. make install

即可
此时把/usr/lib里刚编译好的5个文件linfontconfig.a,linfontconfig.la,linfontconfig.so,linfontconfig.so.1,linfontconfig.so.1.4.4都拷贝到/usr/lib64里,当然提前把lib64里的文件做个备份是好习惯。
此时打开QtCreator编译一下刚才的helloworld,成功了,如图:
Qt creator complier successfully
此时启动一下skype看看,报错如下:

  1. ./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了。

Post a Comment