linux自定义安装QT

安装步骤

1
2
3
./configure -prefix 自定义路径    #生成编译配置文件  
make #编译源代码的lib等
make install #完成安装到指定路径

qt安装包下载:http://download.qt.io/archive/qt/
安装步骤:http://doc.qt.io/qt-5/linux.html
使用文档:http://www.qt.io/developers/

问题解决

在make编译过程中,会出现许多编译问题。在参考编译出错报告后,进行搜索解决。现记录如下。

问题1

1
2
3
In file included from kernel/qtaddons_x11.cpp:25:0:
kernel/qt_x11_p.h:69:22: fatal error: X11/Xlib.h: No such file or directory
compilation terminated.
  • 解决方案

安装所需的libdev开发库:http://doc.qt.io/qt-5/linux-requirements.html
将里面提到的dev都装一下就没问题了。

问题2

1
2
../include/qvaluelist.h:91:13: error: ‘ptrdiff_t’ does not name a type
../include/qmap.h:110:13: error: ‘ptrdiff_t’ does not name a type
  • 解决方案

将qvaluelist.h,qmap.h 文件中, 增加一行:include

问题原理说明为:
https://gcc.gnu.org/gcc-4.6/porting_to.html
https://forum.qt.io/topic/16531/error-ptrdiff_t-does-not-name-a-type/2

问题3

1
2
error while loading shared libraries: libqt.so.3:  
cannot open shared object file: No such file or directory
  • 解决方案

问题原理:http://www.cnblogs.com/yunsicai/p/3458072.html

1
2
3
4
5
6
进入/etc/ld.so.conf.d  
sudo vi -O libc.conf qt.conf

增加了qt.conf 里面指定libqt.so.3位置: /home/angelwhu/Desktop/QT/qt-x11-free-3.3.8b/lib

sudo ldconfig

最后不要忘记 make install,安装软件到指定目录中。

文章作者: angelwhu
文章链接: https://www.angelwhu.com/paper/2015/08/27/linux-custom-installation-qt/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 angelwhu_blog