无法在 20.04 LTS 上安装 libclang

无法在 20.04 LTS 上安装 libclang

尝试安装 libclang-dev 后,sudo apt-get install -y libclang-dev我收到此错误:

The following packages have unmet dependencies:
 libclang-dev : Depends: libclang-10-dev (>= 10~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

当我尝试解决方案

 $ wget https://apt.llvm.org/llvm.sh
 $ chmod +x llvm.sh
 $ sudo ./llvm.sh 12

发生以下情况:

The following packages have unmet dependencies:
 clang-12 : Depends: libclang-common-12-dev (= 1:12.0.1~++20210511012537+24535af52ae1-1~exp1~20210510233243.87) but it is not going to be installed
 clangd-12 : Depends: libclang-common-12-dev (= 1:12.0.1~++20210511012537+24535af52ae1-1~exp1~20210510233243.87) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

输出sudo apt-cache policy libc6

libc6:
  Installed: 2.31-0ubuntu9.2
  Candidate: 2.31-0ubuntu9.2
  Version table:
 *** 2.31-0ubuntu9.2 500
        500 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     2.31-0ubuntu9 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages

答案1

您必须使用以下命令将 libc6 库恢复为正常版本:

sudo apt-get install libc6=2.31-0ubuntu9.2 libc6:i386=2.31-0ubuntu9.2

答案2

对我来说它解决了

sudo apt --fix-broken install
sudo apt-get update

然后安装

sudo dpkg -i rstudio-specific-version.deb

答案3

我遇到了同样的问题。我已经执行了这些步骤(不知道他们做了什么 - 我是新手,但对我有用)

sudo apt-get autoremove

sudo apt-get autoclean

sudo apt-get update

sudo apt-get -f install

答案4

我收到了这条消息:

The following packages have unmet dependencies:
  clang : Depends: clang-10 (>= 10~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我解决了我的问题此解决方案(我自己的格式):

当我这样做时 sudo aptitude install clang,我得到了与所示相同的消息,但随后输入naptitude然后提供了另一个解决方案,即建议降级到gcc9。允许它这样做,然后让它返回到命令提示符。然后执行sudo apt install clang,您将获得clang-10.

相关内容