将配置参数传递给R中安装软件包的命令

12

我正试图从CRAN存储库中安装R包。在configure阶段,我必须传递一个标志,但我不知道如何在install.packages中实现:

> install.packages("Rmpfr")

..........
checking mpfr.h usability... no
checking mpfr.h presence... no
checking for mpfr.h... no
configure: error: Header file mpfr.h not found;
**maybe use --with-mpfr-include=INCLUDE_PATH**
(注意:我已在自定义位置安装了MPFR,因为我没有root权限。) 但是我如何向Rinstall.package命令传递特定的带参数标志呢?例如 " --with-mpfr-include=/path/to/mpfr/include"
根据install.packages手册页面的说明,我尝试了:
install.packages("Rmpfr" , INSTALL_opts = "--with-mpfr-include=/path/to/mpfr/include")

install.packages("Rmpfr" , configure.args = "--with-mpfr-include=/path/to/mpfr/include")

install.packages("Rmpfr" , configure.vars = "--with-mpfr-include=/path/to/mpfr/include")

但是它们都没有奏效,出现了同样的错误。


2
“none of them worked” 指的是所有的都给出了完全相同的错误信息吗?我猜测 configure.args = 语法应该是正确的。你是否验证了指定路径下是否存在头文件? - MrFlick
是的,它们都会给出相同的错误信息。而且,是的,头文件 mpfr.h 确实在提供的路径中。 - cmo
1个回答

20

我刚刚遇到了这个问题,尝试安装udunits2作为ggforce的依赖项。在R开发邮件列表上的这个答案对我的情况起了作用:我需要将一个以包名为键的命名字符向量传递给configure.args。 在您的情况下,应该会起作用:

install.packages("Rmpfr",
  configure.args = c(Rmpfr = "--with-mpfr-include=/path/to/mpfr/include"))

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接