我正在运行带有 Qt4.8.7 的 Ubuntu 16.10,我想安装 Qt5 来编译软件包。我qt5-qmake
从 repo 安装,并将默认设置为 qt5:
export QT_SELECT=qt5
./configure && make
...fatal error: QtCore/QTextCodec: No such file or directory
因此该包无法编译,显然是因为包含语句:
include "<"QtCore/QtGlobal
我认为我需要开发环境。首先,我尝试从 Qt 网站下载 qt-opensource-linux-x64-5.6.1.run 进行安装,然后尝试qtbase5-dev
从 Synaptic 进行安装。
由于依赖项未得到满足,此方法无法正常工作。提到的所有已安装文件都是来自 Ubuntu Yakkety 主存储库的 ubuntu7-2 版本;所需的 ubuntu6-4 版本也可用。它们还用于许多其他软件包中,我不能承受破坏这些软件包的后果。
$ sudo aptitude install qtbase5-dev
The following NEW packages will be installed: libegl1-mesa-dev{a} libgles2-mesa-dev{a} libglu1-mesa-dev{a} libmirclient-dev{ab} libmircommon-dev{ab} libmircookie-dev{ab} libprotobuf-dev{a} libqt5opengl5-dev{ab} libwayland-bin{a} libwayland-dev{a} libxkbcommon-dev{a} qt5-qmake{a} qtbase5-dev{b} qtbase5-dev-tools{a}
0 packages upgraded, 14 newly installed, 0 to remove and 8 not upgraded.
Need to get 4,473 kB of archives. After unpacking 33.6 MB will be used.
The following packages have unmet dependencies:
libqt5opengl5-dev : Depends: libqt5opengl5 (= 5.6.1+dfsg-3ubuntu6~4) but 5.6.1+dfsg-3ubuntu7~2 is installed
libmirclient-dev : Depends: libmirclient9 (= 0.24.0+16.10.20160815.3-0ubuntu2) but 0.24.1+16.10.20160928-0ubuntu1 is installed
libmircommon-dev : Depends: libmircommon6 (= 0.24.0+16.10.20160815.3-0ubuntu2) but 0.24.1+16.10.20160928-0ubuntu1 is installed
qtbase5-dev : Depends: libqt5concurrent5 (= 5.6.1+dfsg-3ubuntu6~4) but 5.6.1+dfsg-3ubuntu7~2 is installed
Depends: libqt5core5a (= 5.6.1+dfsg-3ubuntu6~4) but 5.6.1+dfsg-3ubuntu7~2 is installed
Depends: libqt5dbus5 (= 5.6.1+dfsg-3ubuntu6~4) but 5.6.1+dfsg-3ubuntu7~2 is installed
Depends: libqt5gui5 (= 5.6.1+dfsg-3ubuntu6~4) but 5.6.1+dfsg-3ubuntu7~2 is installed
Depends: libqt5network5 (= 5.6.1+dfsg-3ubuntu6~4) but 5.6.1+dfsg-3ubuntu7~2 is installed
Depends: libqt5printsupport5 (= 5.6.1+dfsg-3ubuntu6~4) but 5.6.1+dfsg-3ubuntu7~2 is installed
Depends: libqt5sql5 (= 5.6.1+dfsg-3ubuntu6~4) but 5.6.1+dfsg-3ubuntu7~2 is installed
Depends: libqt5test5 (= 5.6.1+dfsg-3ubuntu6~4) but 5.6.1+dfsg-3ubuntu7~2 is installed
Depends: libqt5widgets5 (= 5.6.1+dfsg-3ubuntu6~4) but 5.6.1+dfsg-3ubuntu7~2 is installed
Depends: libqt5xml5 (= 5.6.1+dfsg-3ubuntu6~4) but 5.6.1+dfsg-3ubuntu7~2 is installed
libmircookie-dev : Depends: libmircookie2 (= 0.24.0+16.10.20160815.3-0ubuntu2) but 0.24.1+16.10.20160928-0ubuntu1 is installed
The following actions will resolve these dependencies:
Keep the following packages at their current version: 1) libegl1-mesa-dev [Not Installed] 2) libgles2-mesa-dev [Not Installed]
3) libmirclient-dev [Not Installed]
4) libmircommon-dev [Not Installed]
5) libmircookie-dev [Not Installed]
6) libqt5opengl5-dev [Not Installed]
7) qtbase5-dev [Not Installed]
Accept this solution? [Y/n/q/?] ?
Apt-get 的解决方案是保持不变。
Qt 5.6.1 的主 repo 版本需要与其他软件包不同的库,这似乎很奇怪。
看来我需要将这些库从 7.2 降级到 6.4。我可以安全地执行此操作并安装 Qt 5.6.1 吗?或者有更好的方法来解决问题?
$ apt-cache policy libqt5core5a
libqt5core5a:
Installed: 5.6.1+dfsg-3ubuntu7~2
Candidate: 5.6.1+dfsg-3ubuntu7~2
Version table:
*** 5.6.1+dfsg-3ubuntu7~2 100
100 /var/lib/dpkg/status
5.6.1+dfsg-3ubuntu6~4 500
500 http://mirrors.psu.ac.th/ubuntu yakkety/main amd64 Packages
我最终通过使用 Synaptic 强制 qtbase5-dev 依赖以前的版本(Yakkety-upgrades 或 Yakkety)来解决这个问题。
这留下了 libmir 文件。手动安装它们失败,但显示有问题的依赖项。重复依赖项并逐步解决它们最终导致需要降级的一两个文件。
通过 Synaptic 强制执行该操作还会删除大量基本的 Yakkety 应用程序;遗憾的是我找不到同时降级它们的方法,以保持一致的系统,但最后我放弃了它们,安装了 Qt5,并使用 Synaptic 的状态“未安装(残余配置)”部分手动重新安装丢失的软件包来识别和重新安装它们。
我在重启时遇到了一些与安全相关的软件包的小问题,但很快就通过 Google 解决了。