我在这里遇到了一些麻烦。我试图删除 gcc-5,但是有很多依赖项会受其影响。我正在寻找魔术师这可以帮助我卸载它,而不会对我的系统造成很大的影响。
我的系统是:
Description: Ubuntu 16.04.6 LTS
Release: 16.04
Codename: xenial
我过滤了所有想要卸载的与 gcc 5 相关的依赖项,并得到了以下输出:
$ sudo dpkg -l | grep '16.04.11'
ii cpp-5 5.4.0-6ubuntu1~16.04.11 amd64 GNU C preprocessor
ii g++-5 5.4.0-6ubuntu1~16.04.11 amd64 GNU C++ compiler
ii gcc-5 5.4.0-6ubuntu1~16.04.11 amd64 GNU C compiler
ii gcc-5-base:amd64 5.4.0-6ubuntu1~16.04.11 amd64 GCC, the GNU Compiler Collection (base package)
ii gcc-5-base:i386 5.4.0-6ubuntu1~16.04.11 i386 GCC, the GNU Compiler Collection (base package)
ii gfortran-5 5.4.0-6ubuntu1~16.04.11 amd64 GNU Fortran compiler
ii gnome-software 3.20.5-0ubuntu0.16.04.11 amd64 Software Center for GNOME
ii gnome-software-common 3.20.5-0ubuntu0.16.04.11 all Software Center for GNOME (common files)
ii libasan2:amd64 5.4.0-6ubuntu1~16.04.11 amd64 AddressSanitizer -- a fast memory error detector
ii libatomic1:amd64 5.4.0-6ubuntu1~16.04.11 amd64 support library providing __atomic built-in functions
ii libcc1-0:amd64 5.4.0-6ubuntu1~16.04.11 amd64 GCC cc1 plugin for GDB
ii libcilkrts5:amd64 5.4.0-6ubuntu1~16.04.11 amd64 Intel Cilk Plus language extensions (runtime)
ii libgcc-5-dev:amd64 5.4.0-6ubuntu1~16.04.11 amd64 GCC support library (development files)
ii libgd3:amd64 2.1.1-4ubuntu0.16.04.11 amd64 GD Graphics Library
ii libgd3:i386 2.1.1-4ubuntu0.16.04.11 i386 GD Graphics Library
ii libgfortran-5-dev:amd64 5.4.0-6ubuntu1~16.04.11 amd64 Runtime library for GNU Fortran applications (development files)
ii libgfortran3:amd64 5.4.0-6ubuntu1~16.04.11 amd64 Runtime library for GNU Fortran applications
ii libgomp1:amd64 5.4.0-6ubuntu1~16.04.11 amd64 GCC OpenMP (GOMP) support library
ii libitm1:amd64 5.4.0-6ubuntu1~16.04.11 amd64 GNU Transactional Memory Library
ii liblsan0:amd64 5.4.0-6ubuntu1~16.04.11 amd64 LeakSanitizer -- a memory leak detector (runtime)
ii libmpx0:amd64 5.4.0-6ubuntu1~16.04.11 amd64 Intel memory protection extensions (runtime)
ii libquadmath0:amd64 5.4.0-6ubuntu1~16.04.11 amd64 GCC Quad-Precision Math Library
ii libstdc++-5-dev:amd64 5.4.0-6ubuntu1~16.04.11 amd64 GNU Standard C++ Library v3 (development files)
ii libstdc++6:amd64 5.4.0-6ubuntu1~16.04.11 amd64 GNU Standard C++ Library v3
ii libstdc++6:i386 5.4.0-6ubuntu1~16.04.11 i386 GNU Standard C++ Library v3
ii libtsan0:amd64 5.4.0-6ubuntu1~16.04.11 amd64 ThreadSanitizer -- a Valgrind-based detector of data races (runtime)
ii libubsan0:amd64 5.4.0-6ubuntu1~16.04.11 amd64 UBSan -- undefined behaviour sanitizer (runtime)
我已尝试安装特定版本:
$ sudo apt install gcc-5=5.4.0-6ubuntu1~16.04.10
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
gcc-5 : Depends: cpp-5 (= 5.4.0-6ubuntu1~16.04.10) but 5.4.0-6ubuntu1~16.04.11 is to be installed
Depends: gcc-5-base (= 5.4.0-6ubuntu1~16.04.10) but 5.4.0-6ubuntu1~16.04.11 is to be installed
Depends: libgcc-5-dev (= 5.4.0-6ubuntu1~16.04.10) but 5.4.0-6ubuntu1~16.04.11 is to be installed
E: Unable to correct problems, you have held broken packages.
看来我的系统对这个包有多个选项。
$ sudo apt-cache policy cpp-5:amd64
cpp-5:
Installed: 5.4.0-6ubuntu1~16.04.11
Candidate: 5.4.0-6ubuntu1~16.04.11
Version table:
*** 5.4.0-6ubuntu1~16.04.11 100
100 /var/lib/dpkg/status
5.4.0-6ubuntu1~16.04.10 500
500 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages
5.3.1-14ubuntu2 500
500 http://br.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
为了更清楚一点,我想使用与 ubuntu 16.04.10 兼容的 gcc,而不是 16.04.11。
提前致谢!
答案1
Ubuntu 16.04.11 不存在,Xenial 小版本只能到16.04.6。
5.4.0-6ubuntu1~16.04.11 是 gcc-5 的一个可怕的版本“编号”。我认为它应该表示 16.04 特定的补丁,并且仍然可以合理地进行版本比较排序。
必要时更新您的软件包并使用它们。像 Ubuntu 这样的稳定发行版会尝试不将重大更改作为更新发布,即主要版本升级。