请问这个错误可能是什么原因造成的?我正在尝试安装 R 包 ComplexHeatmap,但一直收到错误消息,提示依赖项 Cairo 不可用。我尝试使用命令安装 Cairo,sudo apt-get install libcairo2-dev
但仍然收到相同的错误。运行命令sudo dpkg-query -l | grep libcairo2-dev
还显示 Cairo 包已完全安装。
以下是我运行的命令和相应的输出:
ComplexHeatmap 的安装
> BiocManager::install("ComplexHeatmap")
compilation terminated.
make: *** [/usr/lib/R/etc/Makeconf:168: xlib-backend.o] Error 1
ERROR: compilation failed for package ‘Cairo’
* removing ‘/root/R/x86_64-pc-linux-gnu-library/4.1/Cairo’
ERROR: dependency ‘Cairo’ is not available for package ‘ComplexHeatmap’
* removing ‘/root/R/x86_64-pc-linux-gnu-library/4.1/ComplexHeatmap’
The downloaded source packages are in
‘/tmp/RtmpsD5M9H/downloaded_packages’
Warning messages:
1: In .inet_warning(msg) :
installation of package ‘Cairo’ had non-zero exit status
2: In .inet_warning(msg) :
installation of package ‘ComplexHeatmap’ had non-zero exit status
安装 Cairo:
(base) power@power-SYS-7039A-I:~$ sudo apt-get install libcairo2-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libcairo2-dev is already the newest version (1.16.0-4ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
要验证 Cairo 是否安装正确:
(base) power@power-SYS-7039A-I:~$ sudo dpkg-query -l | grep libcairo2-dev
ii libcairo2-dev:amd64 1.16.0-4ubuntu1 amd64 Development files for the Cairo 2D graphics library
在此先感谢您的帮助。
答案1
您可能不想阅读编译过程中显示的消息。 Cairo 包还需要X11/内部.h从libxt-dev
包裹。
对于带有 R 4.1 的 Ubuntu 20.04 LTS,使用以下命令安装所需的构建依赖项:
sudo apt-get install libcairo2-dev libxt-dev
然后重试。