Cannot install ‘libclang-dev‘--Ubuntu20.04 安装 libclang-dev 插件

Posted Z.Q.Feng

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Cannot install ‘libclang-dev‘--Ubuntu20.04 安装 libclang-dev 插件相关的知识,希望对你有一定的参考价值。

项目场景:

作者是在通过 dpkg 与 gdebi 安装 rstudio 的 deb 包时出现此错误的,本想着通过 apt 安装 libclang-dev 插件,但是绕来绕去都不成功。、

  • 系统环境为 Ubuntu20.04 
  • rstudio 版本为 1.4.1717 
  • R 版本为 4.1.0

具体解决方法如下:


解决方案:

1. 安装 aptitude

打开终端,键入以下命令:

sudo apt-get install aptitude

2. 通过 aptitude 安装 libclang-dev

复制以下命令:

sudo aptitude install clang

接着我们可以看到如下输出:

/home/zq/Downloads> sudo aptitude install clang
The following NEW packages will be installed:
  binfmt-support{a} clang clang-10{a} lib32gcc-s1{a} lib32stdc++6{a} libc6-i386{ab} 
  libclang-common-10-dev{a} libclang-cpp10{a} libobjc-9-dev{a} libobjc4{a} libomp-10-dev{a} 
  libomp5-10{a} libpfm4{a} libz3-4{a} libz3-dev{a} llvm-10{a} llvm-10-dev{a} llvm-10-runtime{a} 
  llvm-10-tools{a} 
0 packages upgraded, 19 newly installed, 0 to remove and 0 not upgraded.
Need to get 57.8 MB of archives. After unpacking 377 MB will be used.
The following packages have unmet dependencies:
 libc6-i386 : Depends: libc6 (= 2.31-0ubuntu9.2) but 2.31-0ubuntu9.3 is installed
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     clang [Not Installed]                              
2)     clang-10 [Not Installed]                           
3)     lib32gcc-s1 [Not Installed]                        
4)     lib32stdc++6 [Not Installed]                       
5)     libc6-i386 [Not Installed]                         
6)     libclang-common-10-dev [Not Installed]             

Accept this solution? [Y/n/q/?] n
The following actions will resolve these dependencies:

     Remove the following packages:                                         
1)     libc-dev-bin [2.31-0ubuntu9.3 (now)]                                 

     Install the following packages:                                        
2)     libc-dev-bin:i386 [2.31-0ubuntu9.2 (focal-updates)]                  

     Downgrade the following packages:                                      
3)     libc6 [2.31-0ubuntu9.3 (now) -> 2.31-0ubuntu9.2 (focal-updates)]     
4)     libc6:i386 [2.31-0ubuntu9.3 (now) -> 2.31-0ubuntu9.2 (focal-updates)]
5)     libc6-dbg [2.31-0ubuntu9.3 (now) -> 2.31-0ubuntu9.2 (focal-updates)] 
6)     libc6-dev [2.31-0ubuntu9.3 (now) -> 2.31-0ubuntu9.2 (focal-updates)] 

注意这里第一个方案我们选 n 拒绝掉, 接着它会提示第二个安装方案,我们选取第二个安装方案:

Accept this solution? [Y/n/q/?] y
The following packages will be DOWNGRADED:
  libc6 libc6:i386 libc6-dbg libc6-dev 
The following NEW packages will be installed:
  binfmt-support{a} clang clang-10{a} lib32gcc-s1{a} lib32stdc++6{a} libc-dev-bin:i386{a} 
  libc6-i386{a} libclang-common-10-dev{a} libclang-cpp10{a} libobjc-9-dev{a} libobjc4{a} 
  libomp-10-dev{a} libomp5-10{a} libpfm4{a} libz3-4{a} libz3-dev{a} llvm-10{a} llvm-10-dev{a} 
  llvm-10-runtime{a} llvm-10-tools{a} 
The following packages will be REMOVED:
  libc-dev-bin{a} 
0 packages upgraded, 20 newly installed, 4 downgraded, 1 to remove and 0 not upgraded.
Need to get 76.2 MB of archives. After unpacking 377 MB will be used.
Do you want to continue? [Y/n/?] y

接着一路点 y,我们就能成功安装 libclang-dev 了。

/home/zq> sudo apt-get install libclang-dev
[sudo] password for zq: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libclang-dev is already the newest version (1:10.0-50~exp1).
libclang-dev set to manually installed.

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
/home/zq>  


有帮助可以点赞哦,谢谢大家的支持~

以上是关于Cannot install ‘libclang-dev‘--Ubuntu20.04 安装 libclang-dev 插件的主要内容,如果未能解决你的问题,请参考以下文章

Cppy cmake 构建无法找到 LibClang

如何在 STL 中使用 libclang?

如何在 libclang c++ 中使用 RecursiveASTVisitor 提取注释并匹配声明?

sencha touch Uncaught TypeError: Cannot read property 'isReady' of undefined sencha-touch-all.js:21

使用 libclang 解析 windows С++ 项目文件(带有 VC 代码库)

/bin/sh: warning: setlocale: LC_ALL: cannot change locale (zh_CN.UTF-8) centos7