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) ...

你可能感兴趣的:(3.Linux系统使用)