在CentOS 5.4 (64B)中安装qt-sdk-linux-x86_64-opensource-2010.03.bin
一、在welcome不显示例子程序 且 编译例子程序时:No valid Qt version set. Set one in Tools/Options
解决:Tools->Options->Qt4->Qt Versions
选择qmake的path: /opt/qtsdk-2010.03/qt/bin/qmake
二、编译时提示错误:
undefined reference to `FcFreeTypeQueryFace'
需要安装fontconfig2.4.2 及其以上版本,而当前版本是2.4.1
在 http://www.freedesktop.org/software/fontconfig/release/ 下载 2.4.2
tar -zxvf fontconfig-2.4.2.tar.gz -C /usr/local/src (解压到src文件夹中)
cd /usr/local/src/fontconfig-2.4.2
./configure --prefix=/opt/fontconfig --with-expat=builtin
mv /usr/lib/libexpat.so /usr/lib/libexpat.so.32
ln -s /usr/lib64/libexpat.so /usr/lib/
updatedb
make
make install
rm /usr/lib/libexpat.so
mv /usr/lib/libexpat.so.32 /usr/lib/libexpat.so
make clean(没必要,留着可以make uninstall)
注意,在Qt工程文件中需要在最后增加
LIBS += -L/opt/fontconfig/lib /
-lfontconfig
对于64bit
1、./configure --sysconfdir=/etc/ --prefix=/usr/ --mandir=/usr/share/man --enable-lib64 --libdir=/usr/lib64/ --with-expat=builtin
2、./configure --prefix=/usr/local/fontconfig --with-freetype-config=/usr/local/freetype/bin/freetype-config --with-expat=builtin
#find /usr -name *libexpat.so*
三、打开sample,可以运行,但是使用debug时:
&"warning: GDB: Failed to set controlling terminal: Invalid argument/n" /bin/bash: error while loading shared libraries: libQtCore.so.4: cannot open shared object file: No such file or directory |
解决方法:
在/etc/ld.so.conf.d目录下增加一个文件qt.conf
# Qt libraries
/opt/qtsdk-2010.03/lib
然后运行
ldconfig
四、运行GDB时:
入gdb调试程序,然后出现下面错误信息:
gdb: error while loading shared libraries: libexpat.so.1: cannot open shared object file: No such file or directory
在网上搜了很长时间找到解决方法,其实方法很简单,就是建立一个软链接:
ln -s /usr/lib/libexpat.so /usr/lib/libexpat.so.1