linux使用 | 安装cmake失败解决方法

linux使用 | 安装cmake失败解决方法

系统环境

[fly@fly-vm ~]$ uname -a
Linux fly-vm 4.15.0-142-generic #146~16.04.1-Ubuntu SMP Tue Apr 13 09:27:15 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux


[fly@fly-vm ]$ cmake
The program 'cmake' is currently not installed. You can install it by typing:
sudo apt install cmake
[fly@fly-vm ]$ sudo apt install cmake
[sudo] password for fly:
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:
 cmake : Depends: cmake-data (= 3.5.1-1ubuntu3) but 3.10.2-1ubuntu2.18.04.2 is to be installed
E: Unable to correct problems, you have held broken packages.

根据提示可知cmake依赖cmake-data (= 3.5.1-1ubuntu3),但是版本3.10.2已经被安装(估计是以前手动安装,升级到最新版导致)。

卸载重新安装,重新安装cmake成功。


[fly@fly-vm ]$ sudo apt-get --purge remove cmake-data
[fly@fly-vm ]$ sudo apt-get install cmake-data


[fly@fly-vm ]$ sudo apt install cmake
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libidn2-0 libnghttp2-14 libpsl5 librhash0 libssl1.1 libunistring2 libuv1 publicsuffix
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libcurl3
Suggested packages:
  codeblocks eclipse ninja-build
The following packages will be REMOVED:
  libcurl4
The following NEW packages will be installed:
  cmake libcurl3
0 upgraded, 2 newly installed, 1 to remove and 48 not upgraded.
Need to get 2,814 kB of archives.
After this operation, 14.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates/main amd64 libcurl3 amd64 7.47.0-1ubuntu2.19 [192 kB]
Get:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates/main amd64 cmake amd64 3.5.1-1ubuntu3 [2,623 kB]
Fetched 2,814 kB in 0s (3,306 kB/s)
(Reading database ... 270505 files and directories currently installed.)
Removing libcurl4:amd64 (7.58.0-2ubuntu3.13) ...
Processing triggers for libc-bin (2.27-3ubuntu1.4) ...
Selecting previously unselected package libcurl3:amd64.
(Reading database ... 270500 files and directories currently installed.)
Preparing to unpack .../libcurl3_7.47.0-1ubuntu2.19_amd64.deb ...
Unpacking libcurl3:amd64 (7.47.0-1ubuntu2.19) ...
Selecting previously unselected package cmake.
Preparing to unpack .../cmake_3.5.1-1ubuntu3_amd64.deb ...
Unpacking cmake (3.5.1-1ubuntu3) ...
Processing triggers for libc-bin (2.27-3ubuntu1.4) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libcurl3:amd64 (7.47.0-1ubuntu2.19) ...
Setting up cmake (3.5.1-1ubuntu3) ...
Processing triggers for libc-bin (2.27-3ubuntu1.4) ...

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值