2016-05-17 31 views
2

我正尝试从CRAN存储库中安装R中的软件包。我在配置阶段传递一个标志,但我无法弄清楚如何做到这一点的install.packages传递配置参数以在R中安装软件包

> 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,因为我不是根)。

但是,如何将具有特定标志的参数传递给install.package命令R .eg “--with-MPFR,包括= /路径/要/ MPFR /包括”

基于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

通过“他们都没有工作,”你的意思是所有给出了完全相同的错误信息?我想'configure.args ='语法应该是正确的。你是否确认了头文件存在于指定的路径中? – MrFlick

+0

是的,他们都给出了相同的错误信息。是的,头文件mpfr.h确实在提供的路径中。 – cmo

回答

3

我刚刚偶然发现了这个问题,试图安装udunits2作为ggforce的依赖项。 This answer在R开发邮件列表工作在我的情况:我需要通过一个命名的字符向量configure.args包名。这应该适用于你的情况,然后:

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