admin管理员组

文章数量:1530893

本文为转载,原文地址: http://blog.csdn/duanlove/article/details/54666441

操作系统(Ubuntu server)环境:

uname -a

Linux ubuntu 3.16.0-23-generic #31-Ubuntu SMP Tue Oct 21 17:56:17 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.10
Release: 14.10
Codename: utopic

网络搜索关键词:

1、 Ubuntu 报错 The following packages have unmet dependencies;

2、 Ubuntu server 14.10 即使替换源也无法解决安装软件的依赖问题;

3、 Ubuntu server 14.10 原始官方源 apt-get update 报错, 显示 如下错误“W: Failed to fetch $URL Packages 404 Not Found [IP: 137.189.4.14 80] E: Some index files failed to download. They have been ignored, or old ones used instead. ”;

4、 Ubuntu 部分软件可以安装成功,但是某些软件(如开发类依赖libc6库的软件)报依赖错误,无法安装成功;

报错提示:

The following packages have unmet dependencies:
libc6-dev : Depends: libc6 (= 2.19-0ubuntu6.9) but 2.19-10ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.
以上报错的含义是:

libc6-dev: 依赖: libc6的 “ 2.19-0ubuntu6.9”版本, 但是系统已安装的是 “2.19-10ubuntu2” 。 

理解了这层意思之后,接下来问题就迎刃而解 了。

报错命令及全文:

root@ubuntu:/etc/apt# apt-get install build-essential
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:
build-essential : Depends: libc6-dev but it is not going to be installed or
libc-dev
Depends: g++ (>= 4:4.4.3) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

root@ubuntu:/etc/apt# apt-get install zlib1g-dev libc6-dev libc-dev libmysqlclient-dev
Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting ‘libc6-dev’ instead of ‘libc-dev’
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:
libc6-dev : Depends: libc6 (= 2.19-0ubuntu6.9)but 2.19-10ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.

root@ubuntu:/etc/apt# apt-get install zlib1g-dev libc6-dev libc-dev libmysqlclient-dev
Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting ‘libc6-dev’ instead of ‘libc-dev’
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:
libc6-dev : Depends: libc6 (= 2.19-0ubuntu6.9) but 2.19-10ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.

解决方案:

查看以安装的libc
root@ubuntu:/etc/apt# dpkg -l | grep libc6
ii libc6:amd64 2.19-10ubuntu2 amd64 GNU C Library: Shared libraries

问题在于,当前系统以安装的 libc6的版本为“2.19-10ubuntu2 ” ,而我们安装其他软件(包括build-essential 、g++等)的时候,所依赖的是“2.19-0ubuntu6.9” 。

也就是问题在于, 依赖的某个软件的版本,跟系统以安装的版本不一致。但 apt-get又不会自动去卸载以安装的自动安装上依赖的目标版本。 所以导致我们需要手动去解决这个问题。 当前解决这个问题办法有很多种,我们这里选择了,直接强制覆盖安装目标版本,替代原来系统已安装的版本。

apt-get install libc6=2.19-0ubuntu6.9

Reading package lists… Done
Building dependency tree
Reading state information… Done
Suggested packages:
glibc-doc
The following packages will be DOWNGRADED:
libc6
0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 77 not upgraded.
Need to get 4,717 kB of archives.
After this operation, 37.9 kB disk space will be freed.
Do you want to continue? [Y/n] Y
Get:1 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main libc6 amd64 2.19-0ubuntu6.9 [4,717 kB]
Fetched 4,717 kB in 0s (8,235 kB/s)
Preconfiguring packages …
dpkg: warning: downgrading libc6:amd64 from 2.19-10ubuntu2 to 2.19-0ubuntu6.9
(Reading database … 69479 files and directories currently installed.)
Preparing to unpack …/libc6_2.19-0ubuntu6.9_amd64.deb …
Unpacking libc6:amd64 (2.19-0ubuntu6.9) over (2.19-10ubuntu2) …
Setting up libc6:amd64 (2.19-0ubuntu6.9) …
Processing triggers for libc-bin (2.19-10ubuntu2) …

再查看libc6的已安装信息:

root@ubuntu:/etc/apt# dpkg -l | grep libc6
ii libc6:amd64 2.19-0ubuntu6.9 amd64 Embedded GNU C Library: Shared libraries

再安装其他原来安装过程报类似错误的软件:

apt-get install zlib1g-dev libc6-dev libc-dev libmysqlclient-dev

Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting ‘libc6-dev’ instead of ‘libc-dev’
The following extra packages will be installed:
libc-dev-bin libmysqlclient18 linux-libc-dev manpages-dev mysql-common
Suggested packages:
glibc-doc
The following NEW packages will be installed:
libc-dev-bin libc6-dev libmysqlclient-dev linux-libc-dev manpages-dev zlib1g-dev
The following packages will be upgraded:
libmysqlclient18 mysql-common
2 upgraded, 6 newly installed, 0 to remove and 75 not upgraded.
Need to get 6,234 kB of archives.
After this operation, 24.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main mysql-common all 5.5.54-0ubuntu0.14.04.1 [13.0 kB]
Get:2 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main libmysqlclient18 amd64 5.5.54-0ubuntu0.14.04.1 [597 kB]
Get:3 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main libc-dev-bin amd64 2.19-0ubuntu6.9 [69.0 kB]
Get:4 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-proposed/main linux-libc-dev amd64 3.13.0-108.155 [772 kB]
Get:5 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main libc6-dev amd64 2.19-0ubuntu6.9 [1,910 kB]
Get:6 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty/main zlib1g-dev amd64 1:1.2.8.dfsg-1ubuntu1 [183 kB]
Get:7 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main libmysqlclient-dev amd64 5.5.54-0ubuntu0.14.04.1 [869 kB]
Get:8 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty/main manpages-dev all 3.54-1ubuntu1 [1,820 kB]
Fetched 6,234 kB in 1s (5,609 kB/s)
(Reading database … 69479 files and directories currently installed.)
Preparing to unpack …/mysql-common_5.5.54-0ubuntu0.14.04.1_all.deb …
Unpacking mysql-common (5.5.54-0ubuntu0.14.04.1) over (5.5.40-0ubuntu1) …
Preparing to unpack …/libmysqlclient18_5.5.54-0ubuntu0.14.04.1_amd64.deb …
Unpacking libmysqlclient18:amd64 (5.5.54-0ubuntu0.14.04.1) over (5.5.40-0ubuntu1) …
Selecting previously unselected package libc-dev-bin.
Preparing to unpack …/libc-dev-bin_2.19-0ubuntu6.9_amd64.deb …
Unpacking libc-dev-bin (2.19-0ubuntu6.9) …
Selecting previously unselected package linux-libc-dev:amd64.
Preparing to unpack …/linux-libc-dev_3.13.0-108.155_amd64.deb …
Unpacking linux-libc-dev:amd64 (3.13.0-108.155) …
Selecting previously unselected package libc6-dev:amd64.
Preparing to unpack …/libc6-dev_2.19-0ubuntu6.9_amd64.deb …
Unpacking libc6-dev:amd64 (2.19-0ubuntu6.9) …
Selecting previously unselected package zlib1g-dev:amd64.
Preparing to unpack …/zlib1g-dev_1%3a1.2.8.dfsg-1ubuntu1_amd64.deb …
Unpacking zlib1g-dev:amd64 (1:1.2.8.dfsg-1ubuntu1) …
Selecting previously unselected package libmysqlclient-dev.
Preparing to unpack …/libmysqlclient-dev_5.5.54-0ubuntu0.14.04.1_amd64.deb …
Unpacking libmysqlclient-dev (5.5.54-0ubuntu0.14.04.1) …
Selecting previously unselected package manpages-dev.
Preparing to unpack …/manpages-dev_3.54-1ubuntu1_all.deb …
Unpacking manpages-dev (3.54-1ubuntu1) …
Processing triggers for man-db (2.7.0.2-2) …

从以上安装过程看出来,成功安装了。

我们再次执行如下命令 通过dpkg来查询具体安装信息:

root@ubuntu:/etc/apt# dpkg -l | grep -E “zlib1g-dev|libc6-dev|libc-dev|libmysqlclient-dev”
ii libc-dev-bin 2.19-0ubuntu6.9 amd64 Embedded GNU C Library: Development binaries
ii libc6-dev:amd64 2.19-0ubuntu6.9 amd64 Embedded GNU C Library: Development Libraries and Header Files
ii libmysqlclient-dev 5.5.54-0ubuntu0.14.04.1 amd64 MySQL database development files
ii linux-libc-dev:amd64 3.13.0-108.155 amd64 Linux Kernel Headers for development
ii zlib1g-dev:amd64 1:1.2.8.dfsg-1ubuntu1 amd64 compression library - development

再次确认build-essential 是否可以成功安装:

dpkg -l | grep build-essential

当前系统没有安装 build-essential。

dpkg -l | grep g++

当前系统没有安装 g++。

dpkg -l | grep gcc

ii gcc 4:4.8.2-1ubuntu6 amd64 GNU C compiler
ii gcc-4.8 4.8.4-2ubuntu1~14.04.3 amd64 GNU C compiler
ii gcc-4.8-base:amd64 4.8.4-2ubuntu1~14.04.3 amd64 GCC, the GNU Compiler Collection (base package)
ii gcc-4.9-base:amd64 4.9.1-16ubuntu6 amd64 GCC, the GNU Compiler Collection (base package)
ii libgcc-4.8-dev:amd64 4.8.4-2ubuntu1~14.04.3 amd64 GCC support library (development files)
ii libgcc1:amd64 1:4.9.1-16ubuntu6 amd64 GCC support library

安装 build-essential (g++也会被附带安装,所以只要安装这个基础套件,基本的编译环境就ok了):

apt-get install build-essential

Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
g++ g+±4.8 libstdc+±4.8-dev
Suggested packages:
g+±multilib g+±4.8-multilib gcc-4.8-doc libstdc++6-4.8-dbg libstdc+±4.8-doc
The following NEW packages will be installed:
build-essential g++ g+±4.8 libstdc+±4.8-dev
0 upgraded, 4 newly installed, 0 to remove and 75 not upgraded.
Need to get 19.2 MB of archives.
After this operation, 40.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main libstdc+±4.8-dev amd64 4.8.4-2ubuntu1~14.04.3 [1,053 kB]
Get:2 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main g+±4.8 amd64 4.8.4-2ubuntu1~14.04.3 [18.1 MB]
Get:3 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty/main g++ amd64 4:4.8.2-1ubuntu6 [1,490 B]
Get:4 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty/main build-essential amd64 11.6ubuntu6 [4,838 B]
Fetched 19.2 MB in 1s (9,947 kB/s)
Selecting previously unselected package libstdc+±4.8-dev:amd64.
(Reading database … 72784 files and directories currently installed.)
Preparing to unpack …/libstdc+±4.8-dev_4.8.4-2ubuntu1~14.04.3_amd64.deb …
Unpacking libstdc+±4.8-dev:amd64 (4.8.4-2ubuntu1~14.04.3) …
Selecting previously unselected package g+±4.8.
Preparing to unpack …/g+±4.8_4.8.4-2ubuntu1~14.04.3_amd64.deb …
Unpacking g+±4.8 (4.8.4-2ubuntu1~14.04.3) …
Selecting previously unselected package g++.
Preparing to unpack …/g++_4%3a4.8.2-1ubuntu6_amd64.deb …
Unpacking g++ (4:4.8.2-1ubuntu6) …
Selecting previously unselected package build-essential.
Preparing to unpack …/build-essential_11.6ubuntu6_amd64.deb …
Unpacking build-essential (11.6ubuntu6) …
Processing triggers for man-db (2.7.0.2-2) …

安装过程成功走完,并且无任何报错提示。

检查 build-essential 和 g++是否成功安装:

dpkg -l | grep -E “build-essential|g++”

ii build-essential 11.6ubuntu6 amd64 Informational list of build-essential packages
ii g++ 4:4.8.2-1ubuntu6 amd64 GNU C++ compiler
ii g+±4.8 4.8.4-2ubuntu1~14.04.3 amd64 GNU C++ compiler

确定已成功安装!!!!

最终问题解决。

补充:

 这里有个深层次的原因: Ubuntu 14.10 版本在当前(2016/2017)已经从维护名单里面去除了,相应的源也不再支持,所以导致原始匹配版本的源无法使用,ping不通服务器ip。 而我这里配置的是 14.04对应的源, 其安装软件时依赖的版本是与 14.10是有差异的,所以导致 安装一些软件的时候, 依赖的软件的版本总是比当前系统已经安装的版本要低。 导致依赖冲突,最终导致安装软件无法顺利进行。 

————————————————
版权声明:本文为CSDN博主「duanlove」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn/duanlove/article/details/54666441本文为原创,原文地址: http://blog.csdn/duanlove/article/details/54666441

操作系统(Ubuntu server)环境:

uname -a

Linux ubuntu 3.16.0-23-generic #31-Ubuntu SMP Tue Oct 21 17:56:17 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.10
Release: 14.10
Codename: utopic

网络搜索关键词:

1、 Ubuntu 报错 The following packages have unmet dependencies;

2、 Ubuntu server 14.10 即使替换源也无法解决安装软件的依赖问题;

3、 Ubuntu server 14.10 原始官方源 apt-get update 报错, 显示 如下错误“W: Failed to fetch $URL Packages 404 Not Found [IP: 137.189.4.14 80] E: Some index files failed to download. They have been ignored, or old ones used instead. ”;

4、 Ubuntu 部分软件可以安装成功,但是某些软件(如开发类依赖libc6库的软件)报依赖错误,无法安装成功;

报错提示:

The following packages have unmet dependencies:
libc6-dev : Depends: libc6 (= 2.19-0ubuntu6.9) but 2.19-10ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.
以上报错的含义是:

libc6-dev: 依赖: libc6的 “ 2.19-0ubuntu6.9”版本, 但是系统已安装的是 “2.19-10ubuntu2” 。 

理解了这层意思之后,接下来问题就迎刃而解 了。

报错命令及全文:

root@ubuntu:/etc/apt# apt-get install build-essential
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:
build-essential : Depends: libc6-dev but it is not going to be installed or
libc-dev
Depends: g++ (>= 4:4.4.3) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

root@ubuntu:/etc/apt# apt-get install zlib1g-dev libc6-dev libc-dev libmysqlclient-dev
Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting ‘libc6-dev’ instead of ‘libc-dev’
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:
libc6-dev : Depends: libc6 (= 2.19-0ubuntu6.9)but 2.19-10ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.

root@ubuntu:/etc/apt# apt-get install zlib1g-dev libc6-dev libc-dev libmysqlclient-dev
Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting ‘libc6-dev’ instead of ‘libc-dev’
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:
libc6-dev : Depends: libc6 (= 2.19-0ubuntu6.9) but 2.19-10ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.

解决方案:

查看以安装的libc
root@ubuntu:/etc/apt# dpkg -l | grep libc6
ii libc6:amd64 2.19-10ubuntu2 amd64 GNU C Library: Shared libraries

问题在于,当前系统以安装的 libc6的版本为“2.19-10ubuntu2 ” ,而我们安装其他软件(包括build-essential 、g++等)的时候,所依赖的是“2.19-0ubuntu6.9” 。

也就是问题在于, 依赖的某个软件的版本,跟系统以安装的版本不一致。但 apt-get又不会自动去卸载以安装的自动安装上依赖的目标版本。 所以导致我们需要手动去解决这个问题。 当前解决这个问题办法有很多种,我们这里选择了,直接强制覆盖安装目标版本,替代原来系统已安装的版本。

apt-get install libc6=2.19-0ubuntu6.9

Reading package lists… Done
Building dependency tree
Reading state information… Done
Suggested packages:
glibc-doc
The following packages will be DOWNGRADED:
libc6
0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 77 not upgraded.
Need to get 4,717 kB of archives.
After this operation, 37.9 kB disk space will be freed.
Do you want to continue? [Y/n] Y
Get:1 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main libc6 amd64 2.19-0ubuntu6.9 [4,717 kB]
Fetched 4,717 kB in 0s (8,235 kB/s)
Preconfiguring packages …
dpkg: warning: downgrading libc6:amd64 from 2.19-10ubuntu2 to 2.19-0ubuntu6.9
(Reading database … 69479 files and directories currently installed.)
Preparing to unpack …/libc6_2.19-0ubuntu6.9_amd64.deb …
Unpacking libc6:amd64 (2.19-0ubuntu6.9) over (2.19-10ubuntu2) …
Setting up libc6:amd64 (2.19-0ubuntu6.9) …
Processing triggers for libc-bin (2.19-10ubuntu2) …

再查看libc6的已安装信息:

root@ubuntu:/etc/apt# dpkg -l | grep libc6
ii libc6:amd64 2.19-0ubuntu6.9 amd64 Embedded GNU C Library: Shared libraries

再安装其他原来安装过程报类似错误的软件:

apt-get install zlib1g-dev libc6-dev libc-dev libmysqlclient-dev

Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting ‘libc6-dev’ instead of ‘libc-dev’
The following extra packages will be installed:
libc-dev-bin libmysqlclient18 linux-libc-dev manpages-dev mysql-common
Suggested packages:
glibc-doc
The following NEW packages will be installed:
libc-dev-bin libc6-dev libmysqlclient-dev linux-libc-dev manpages-dev zlib1g-dev
The following packages will be upgraded:
libmysqlclient18 mysql-common
2 upgraded, 6 newly installed, 0 to remove and 75 not upgraded.
Need to get 6,234 kB of archives.
After this operation, 24.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main mysql-common all 5.5.54-0ubuntu0.14.04.1 [13.0 kB]
Get:2 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main libmysqlclient18 amd64 5.5.54-0ubuntu0.14.04.1 [597 kB]
Get:3 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main libc-dev-bin amd64 2.19-0ubuntu6.9 [69.0 kB]
Get:4 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-proposed/main linux-libc-dev amd64 3.13.0-108.155 [772 kB]
Get:5 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main libc6-dev amd64 2.19-0ubuntu6.9 [1,910 kB]
Get:6 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty/main zlib1g-dev amd64 1:1.2.8.dfsg-1ubuntu1 [183 kB]
Get:7 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main libmysqlclient-dev amd64 5.5.54-0ubuntu0.14.04.1 [869 kB]
Get:8 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty/main manpages-dev all 3.54-1ubuntu1 [1,820 kB]
Fetched 6,234 kB in 1s (5,609 kB/s)
(Reading database … 69479 files and directories currently installed.)
Preparing to unpack …/mysql-common_5.5.54-0ubuntu0.14.04.1_all.deb …
Unpacking mysql-common (5.5.54-0ubuntu0.14.04.1) over (5.5.40-0ubuntu1) …
Preparing to unpack …/libmysqlclient18_5.5.54-0ubuntu0.14.04.1_amd64.deb …
Unpacking libmysqlclient18:amd64 (5.5.54-0ubuntu0.14.04.1) over (5.5.40-0ubuntu1) …
Selecting previously unselected package libc-dev-bin.
Preparing to unpack …/libc-dev-bin_2.19-0ubuntu6.9_amd64.deb …
Unpacking libc-dev-bin (2.19-0ubuntu6.9) …
Selecting previously unselected package linux-libc-dev:amd64.
Preparing to unpack …/linux-libc-dev_3.13.0-108.155_amd64.deb …
Unpacking linux-libc-dev:amd64 (3.13.0-108.155) …
Selecting previously unselected package libc6-dev:amd64.
Preparing to unpack …/libc6-dev_2.19-0ubuntu6.9_amd64.deb …
Unpacking libc6-dev:amd64 (2.19-0ubuntu6.9) …
Selecting previously unselected package zlib1g-dev:amd64.
Preparing to unpack …/zlib1g-dev_1%3a1.2.8.dfsg-1ubuntu1_amd64.deb …
Unpacking zlib1g-dev:amd64 (1:1.2.8.dfsg-1ubuntu1) …
Selecting previously unselected package libmysqlclient-dev.
Preparing to unpack …/libmysqlclient-dev_5.5.54-0ubuntu0.14.04.1_amd64.deb …
Unpacking libmysqlclient-dev (5.5.54-0ubuntu0.14.04.1) …
Selecting previously unselected package manpages-dev.
Preparing to unpack …/manpages-dev_3.54-1ubuntu1_all.deb …
Unpacking manpages-dev (3.54-1ubuntu1) …
Processing triggers for man-db (2.7.0.2-2) …

从以上安装过程看出来,成功安装了。

我们再次执行如下命令 通过dpkg来查询具体安装信息:

root@ubuntu:/etc/apt# dpkg -l | grep -E “zlib1g-dev|libc6-dev|libc-dev|libmysqlclient-dev”
ii libc-dev-bin 2.19-0ubuntu6.9 amd64 Embedded GNU C Library: Development binaries
ii libc6-dev:amd64 2.19-0ubuntu6.9 amd64 Embedded GNU C Library: Development Libraries and Header Files
ii libmysqlclient-dev 5.5.54-0ubuntu0.14.04.1 amd64 MySQL database development files
ii linux-libc-dev:amd64 3.13.0-108.155 amd64 Linux Kernel Headers for development
ii zlib1g-dev:amd64 1:1.2.8.dfsg-1ubuntu1 amd64 compression library - development

再次确认build-essential 是否可以成功安装:

dpkg -l | grep build-essential

当前系统没有安装 build-essential。

dpkg -l | grep g++

当前系统没有安装 g++。

dpkg -l | grep gcc

ii gcc 4:4.8.2-1ubuntu6 amd64 GNU C compiler
ii gcc-4.8 4.8.4-2ubuntu1~14.04.3 amd64 GNU C compiler
ii gcc-4.8-base:amd64 4.8.4-2ubuntu1~14.04.3 amd64 GCC, the GNU Compiler Collection (base package)
ii gcc-4.9-base:amd64 4.9.1-16ubuntu6 amd64 GCC, the GNU Compiler Collection (base package)
ii libgcc-4.8-dev:amd64 4.8.4-2ubuntu1~14.04.3 amd64 GCC support library (development files)
ii libgcc1:amd64 1:4.9.1-16ubuntu6 amd64 GCC support library

安装 build-essential (g++也会被附带安装,所以只要安装这个基础套件,基本的编译环境就ok了):

apt-get install build-essential

Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
g++ g+±4.8 libstdc+±4.8-dev
Suggested packages:
g+±multilib g+±4.8-multilib gcc-4.8-doc libstdc++6-4.8-dbg libstdc+±4.8-doc
The following NEW packages will be installed:
build-essential g++ g+±4.8 libstdc+±4.8-dev
0 upgraded, 4 newly installed, 0 to remove and 75 not upgraded.
Need to get 19.2 MB of archives.
After this operation, 40.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main libstdc+±4.8-dev amd64 4.8.4-2ubuntu1~14.04.3 [1,053 kB]
Get:2 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main g+±4.8 amd64 4.8.4-2ubuntu1~14.04.3 [18.1 MB]
Get:3 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty/main g++ amd64 4:4.8.2-1ubuntu6 [1,490 B]
Get:4 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty/main build-essential amd64 11.6ubuntu6 [4,838 B]
Fetched 19.2 MB in 1s (9,947 kB/s)
Selecting previously unselected package libstdc+±4.8-dev:amd64.
(Reading database … 72784 files and directories currently installed.)
Preparing to unpack …/libstdc+±4.8-dev_4.8.4-2ubuntu1~14.04.3_amd64.deb …
Unpacking libstdc+±4.8-dev:amd64 (4.8.4-2ubuntu1~14.04.3) …
Selecting previously unselected package g+±4.8.
Preparing to unpack …/g+±4.8_4.8.4-2ubuntu1~14.04.3_amd64.deb …
Unpacking g+±4.8 (4.8.4-2ubuntu1~14.04.3) …
Selecting previously unselected package g++.
Preparing to unpack …/g++_4%3a4.8.2-1ubuntu6_amd64.deb …
Unpacking g++ (4:4.8.2-1ubuntu6) …
Selecting previously unselected package build-essential.
Preparing to unpack …/build-essential_11.6ubuntu6_amd64.deb …
Unpacking build-essential (11.6ubuntu6) …
Processing triggers for man-db (2.7.0.2-2) …

安装过程成功走完,并且无任何报错提示。

检查 build-essential 和 g++是否成功安装:

dpkg -l | grep -E “build-essential|g++”

ii build-essential 11.6ubuntu6 amd64 Informational list of build-essential packages
ii g++ 4:4.8.2-1ubuntu6 amd64 GNU C++ compiler
ii g+±4.8 4.8.4-2ubuntu1~14.04.3 amd64 GNU C++ compiler

确定已成功安装!!!!

最终问题解决。

补充:

 这里有个深层次的原因: Ubuntu 14.10 版本在当前(2016/2017)已经从维护名单里面去除了,相应的源也不再支持,所以导致原始匹配版本的源无法使用,ping不通服务器ip。 而我这里配置的是 14.04对应的源, 其安装软件时依赖的版本是与 14.10是有差异的,所以导致 安装一些软件的时候, 依赖的软件的版本总是比当前系统已经安装的版本要低。 导致依赖冲突,最终导致安装软件无法顺利进行。 

本文标签: dependenciesBuildpackagesunmetdev