【Qt】在ubuntu14.04上安装Qt5.12(失败)

注意

在ubuntu14.04上安装Qt5.12最终失败了,Qt5.12需要的libdbus库的版本和ubuntu14.04中的不一致,如果强行升级libdbus库版本,会导致系统桌面无法启动。
再次提示:不要按照下述步骤操作,它只是一个记录失败操作的笔记。
如果有大神安装成功了,还请不吝赐教。

1、安装Qt
1.1 下载安装包:

Qt5.12下载地址
http://download.qt.io/official_releases/qt/5.12/5.12.3/
选择qt-opensource-linux-x64-5.12.3.run下载

1.2 安装Qt

将qt-opensource-linux-x64-5.12.3.run拷贝到ubuntu14.04中
运行命令:./qt-opensource-linux-x64-5.12.3.run
选择需要的安装组建,安装提示安装即可

2、运行Qt5.12时遇到的错误及解决方法
2.1 报错:undefined symbol: FT_Get_Font_Format

1)运行Qt5.12的qtcreator时报错

$ ./Qt5.12.3/Tools/QtCreator/bin/qtcreator  
./Qt5.12.3/Tools/QtCreator/bin/qtcreator: symbol lookup error: 
/home/workspace/Qt5.12.3/Tools/QtCreator/lib/Qt/plugins/platforms/../..
/lib/libQt5XcbQpa.so.5: undefined symbol: FT_Get_Font_Format

2)解决方法
安装最新的libfreetype
源码下载地址:
http://download.savannah.gnu.org/releases/freetype/
选择最新的版本freetype-2.10.0.tar.bz2: http://download.savannah.gnu.org/releases/freetype/freetype-2.10.0.tar.bz2
拷贝到ubuntu14.04中,执行以下步骤,编译、安装freetype-2.10.0

$ mkdir freetype  //freetype-2.10.0的安装目录
$ tar -xf freetype-2.10.0.tar.bz2
$ cd freetype-2.10.0
$ ./configure --prefix=/home/workspace/tools/freetype
$ make
$ make install

设置环境变量

$ cd ~
$ vi .bashrc
#添加:
export LD_LIBRARY_PATH=/home/workspace/tools/freetype/lib:$LD_LIBRARY_PATH

注意:将/home/workspace/tools/freetype/lib目录放在前面,以屏蔽 /usr/lib/x86_64-linux-gnu/ 目录下的 libfreetype.so.6

2.2 再次运行报错:symbol dbus_message_get_allow_interactive_authorization, version LIBDBUS_1_3 not defined in file libdbus-1.so.3 with link time reference

1)运行Qt5.12的qtcreator报错:

$ ./Qt5.12.3/Tools/QtCreator/bin/qtcreator  
./Qt5.12.3/Tools/QtCreator/bin/qtcreator: relocation error: 
/home/workspace/Qt5.12.3/Tools/QtCreator/lib/Qt/plugins/platforms/../../
lib/libQt5DBus.so.5: symbol dbus_message_get_allow_interactive_authorization, 
version LIBDBUS_1_3 not defined in file libdbus-1.so.3 with link time reference

2)解决方法
安装最新的libdbus库
源码下载地址
https://dbus.freedesktop.org/releases/dbus/
选择libdbus.1.13.8下载: https://dbus.freedesktop.org/releases/dbus/dbus-1.13.8.tar.xz
拷贝到ubuntu14.04中,执行以下步骤,编译、安装dbus-1.13.8.tar.xz

$ mkdir dbus  //dbus-1.13.8的安装目录
$ tar -xf dbus-1.13.8.tar.xz
$ cd dbus-1.13.8
$ ./configure --prefix=/home/workspace/tools/dbus
$ make
$ make install

设置环境变量

$ cd ~
$ vi .bashrc
#添加:
export export LD_LIBRARY_PATH=/home/workspace/tools/dbus/lib:$LD_LIBRARY_PATH

注意:将/home/workspace/tools/dbus/lib目录放在前面,以屏蔽 /usr/lib/x86_64-linux-gnu/ 目录下的 libdbus-1.so.3

2.4 设置工具->环境时报错:dbus/machine-id": No such file or directory

1)在QtCreator中 工具 --> 选择 --> 环境 --> 用户界面 --> 颜色 点击报错

$ ./Qt5.12.3/Tools/QtCreator/bin/qtcreator 
dbus[18091]: D-Bus library appears to be incorrectly set up: 
see the manual page for dbus-uuidgen to correct this issue. 
(Failed to open "/home/zet/tools/qt/dbus/var/lib/dbus/machine-id": 
No such file or directory; Failed to open "/etc/machine-id": No such file or directory)
D-Bus not built with -rdynamic so unable to print a backtrace

2)解决方法:

$ /home/workspace/tools/qt/dbus/bin/dbus-uuidgen > /home/workspace/tools/qt/dbus/var/lib/dbus/machine-id
2.4 当有键盘输入时报错:qt.qpa.xkeyboard: no keyboard layouts with latin keys present

同时QtCreator崩溃,未解决

你可能感兴趣的:(Qt)