admin管理员组文章数量:1663191
环境:
ubuntu 20.04 + ros
issue:
(base) alex@ubuntu-16-04:~/catkin_ws$ sudo apt 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: gcc (>= 4:9.2) but it is not going to be installed
Depends: g++ (>= 4:9.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
solution:
可以看到build-essential 依赖gcc
build-essential : Depends: gcc (>= 4:9.2) but it is not going to be installed
Depends: g++ (>= 4:9.2) but it is not going to be installed
于是尝试安装 gcc
(base) alex@ubuntu-16-04:~/catkin$ sudo apt install gcc
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 : Depends: cpp (= 4:9.3.0-1ubuntu2) but 4:7.4.0-1ubuntu2.3 is to be installed
Depends: gcc-9 (>= 9.3.0-3~) but it is not going to be installed
E: Unable to correct problems, you have held broken package
这里可以发现gcc依赖cpp,于是先安装gcc-9
(base) alex@ubuntu-16-04:~/catkin$ sudo apt install gcc-9
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-9 : Depends: cpp-9 (= 9.3.0-17ubuntu1~20.04) but it is not going to be installed
Depends: gcc-9-base (= 9.3.0-17ubuntu1~20.04) but 9.4.0-1ubuntu1~16.04 is to be installed
Depends: libgcc-9-dev (= 9.3.0-17ubuntu1~20.04) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
继续安装cpp-9,提示cpp-9依赖gcc-9-base,不过此包已安装,不过细心的人会发现gcc-9-base是ubuntu 16.04的版本,因为我的ubuntu是从16.04升级到了ubuntu 20.04,所以才会这样。于是先卸载它,再重新安装。
(base) alex@ubuntu-16-04:~/catkin$ sudo apt install cpp-9
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:
cpp-9 : Depends: gcc-9-base (= 9.3.0-17ubuntu1~20.04) but 9.4.0-1ubuntu1~16.04 is to be installed
E: Unable to correct problems, you have held broken packages.
(base) alex@ubuntu-16-04:~/catkin$ sudo apt remove gcc-9-base
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-4.15.0-161 linux-headers-4.15.0-161-generic
linux-image-4.15.0-161-generic linux-modules-4.15.0-161-generic
linux-modules-extra-4.15.0-161-generic
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
gcc-9-base
0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded.
After this operation, 271 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 383847 files and directories currently installed.)
Removing gcc-9-base:amd64 (9.4.0-1ubuntu1~16.04) ...
安装成功:
base) alex@ubuntu-16-04:~/catkin$ sudo apt install build-essential
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-4.15.0-161 linux-headers-4.15.0-161-generic
linux-image-4.15.0-161-generic linux-modules-4.15.0-161-generic
linux-modules-extra-4.15.0-161-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
cpp cpp-9 g++ g++-9 gcc gcc-9 gcc-9-base libasan5 libgcc-9-dev
libstdc++-9-dev
Suggested packages:
cpp-doc gcc-9-locales g++-multilib g++-9-multilib gcc-9-doc gcc-multilib
gcc-doc gcc-9-multilib libstdc++-9-doc
The following packages will be REMOVED:
gcc-9-base:i386
The following NEW packages will be installed:
build-essential cpp-9 g++ g++-9 gcc gcc-9 gcc-9-base libasan5 libgcc-9-dev
libstdc++-9-dev
The following packages will be upgraded:
cpp
1 upgraded, 10 newly installed, 1 to remove and 0 not upgraded.
Need to get 28.7 MB of archives.
After this operation, 120 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrors.aliyun/ubuntu focal-updates/main amd64 gcc-9-base amd64 9.3.0-17ubuntu1~20.04 [19.1 kB]
Get:2 http://mirrors.aliyun/ubuntu focal-updates/main amd64 cpp-9 amd64 9.3.0-17ubuntu1~20.04 [7,494 kB]
Get:3 http://mirrors.aliyun/ubuntu focal/main amd64 cpp amd64 4:9.3.0-1ubuntu2 [27.6 kB]
Get:4 http://mirrors.aliyun/ubuntu focal-updates/main amd64 libasan5 amd64 9.3.0-17ubuntu1~20.04 [394 kB]
Get:5 http://mirrors.aliyun/ubuntu focal-updates/main amd64 libgcc-9-dev amd64 9.3.0-17ubuntu1~20.04 [2,360 kB]
Get:6 http://mirrors.aliyun/ubuntu focal-updates/main amd64 gcc-9 amd64 9.3.0-17ubuntu1~20.04 [8,241 kB]
Get:7 http://mirrors.aliyun/ubuntu focal/main amd64 gcc amd64 4:9.3.0-1ubuntu2 [5,208 B]
Get:8 http://mirrors.aliyun/ubuntu focal-updates/main amd64 libstdc++-9-dev amd64 9.3.0-17ubuntu1~20.04 [1,714 kB]
Get:9 http://mirrors.aliyun/ubuntu focal-updates/main amd64 g++-9 amd64 9.3.0-17ubuntu1~20.04 [8,405 kB]
Get:10 http://mirrors.aliyun/ubuntu focal/main amd64 g++ amd64 4:9.3.0-1ubuntu2 [1,604 B]
Get:11 http://mirrors.aliyun/ubuntu focal-updates/main amd64 build-essential amd64 12.8ubuntu1.1 [4,664 B]
Fetched 28.7 MB in 2s (13.9 MB/s)
(Reading database ... 383846 files and directories currently installed.)
Removing gcc-9-base:i386 (9.4.0-1ubuntu1~16.04) ...
Selecting previously unselected package gcc-9-base:amd64.
(Reading database ... 383841 files and directories currently installed.)
Preparing to unpack .../00-gcc-9-base_9.3.0-17ubuntu1~20.04_amd64.deb ...
Unpacking gcc-9-base:amd64 (9.3.0-17ubuntu1~20.04) ...
Selecting previously unselected package cpp-9.
Preparing to unpack .../01-cpp-9_9.3.0-17ubuntu1~20.04_amd64.deb ...
Unpacking cpp-9 (9.3.0-17ubuntu1~20.04) ...
Preparing to unpack .../02-cpp_4%3a9.3.0-1ubuntu2_amd64.deb ...
Unpacking cpp (4:9.3.0-1ubuntu2) over (4:7.4.0-1ubuntu2.3) ...
Selecting previously unselected package libasan5:amd64.
Preparing to unpack .../03-libasan5_9.3.0-17ubuntu1~20.04_amd64.deb ...
Unpacking libasan5:amd64 (9.3.0-17ubuntu1~20.04) ...
Selecting previously unselected package libgcc-9-dev:amd64.
Preparing to unpack .../04-libgcc-9-dev_9.3.0-17ubuntu1~20.04_amd64.deb ...
Unpacking libgcc-9-dev:amd64 (9.3.0-17ubuntu1~20.04) ...
Selecting previously unselected package gcc-9.
Preparing to unpack .../05-gcc-9_9.3.0-17ubuntu1~20.04_amd64.deb ...
Unpacking gcc-9 (9.3.0-17ubuntu1~20.04) ...
Selecting previously unselected package gcc.
Preparing to unpack .../06-gcc_4%3a9.3.0-1ubuntu2_amd64.deb ...
Unpacking gcc (4:9.3.0-1ubuntu2) ...
Selecting previously unselected package libstdc++-9-dev:amd64.
Preparing to unpack .../07-libstdc++-9-dev_9.3.0-17ubuntu1~20.04_amd64.deb ...
Unpacking libstdc++-9-dev:amd64 (9.3.0-17ubuntu1~20.04) ...
Selecting previously unselected package g++-9.
Preparing to unpack .../08-g++-9_9.3.0-17ubuntu1~20.04_amd64.deb ...
Unpacking g++-9 (9.3.0-17ubuntu1~20.04) ...
Selecting previously unselected package g++.
Preparing to unpack .../09-g++_4%3a9.3.0-1ubuntu2_amd64.deb ...
Unpacking g++ (4:9.3.0-1ubuntu2) ...
Selecting previously unselected package build-essential.
Preparing to unpack .../10-build-essential_12.8ubuntu1.1_amd64.deb ...
Unpacking build-essential (12.8ubuntu1.1) ...
Setting up gcc-9-base:amd64 (9.3.0-17ubuntu1~20.04) ...
Setting up libasan5:amd64 (9.3.0-17ubuntu1~20.04) ...
Setting up cpp-9 (9.3.0-17ubuntu1~20.04) ...
Setting up libgcc-9-dev:amd64 (9.3.0-17ubuntu1~20.04) ...
Setting up cpp (4:9.3.0-1ubuntu2) ...
Setting up gcc-9 (9.3.0-17ubuntu1~20.04) ...
Setting up libstdc++-9-dev:amd64 (9.3.0-17ubuntu1~20.04) ...
Setting up gcc (4:9.3.0-1ubuntu2) ...
Setting up g++-9 (9.3.0-17ubuntu1~20.04) ...
Setting up g++ (4:9.3.0-1ubuntu2) ...
update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mo
de
Setting up build-essential (12.8ubuntu1.1) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
本文标签: essentialBuildSolutionDependsinstalle
版权声明:本文标题:solution for build-essential : Depends: gcc (>= 4:9.2) but it is not going to be installe 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1726241880a1062231.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论