10

I am trying to install a package in R from the CRAN repository. I have to pass a flag at the configure stage, but I can't figure out how to do it in 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**

(Note: I have MPFR installed in a custom location, since I am not root).

But how do I pass a specific flag with argument to the install.package command of R? .e.g " --with-mpfr-include=/path/to/mpfr/include "

based on the install.packages man page, I have tried:

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")

But none of them worked, with the same error.

Psidom
  • 209,562
  • 33
  • 339
  • 356
cmo
  • 3,762
  • 4
  • 36
  • 64
  • 2
    By "none of them worked," you mean all gave the exact same error message? I would guess the `configure.args =` syntax should be correct. And did you verify that header file is present at the path specified? – MrFlick May 17 '16 at 22:37
  • yes, they all give the same error message. And yes, the header mpfr.h is indeed in the provided path. – cmo May 17 '16 at 22:53

1 Answers1

18

I just stumbled upon this problem myself, trying to install udunits2 as a dependency of ggforce. This answer on the R devel mailing list worked in my case: I needed to pass a named character vector to configure.args keyed by the package name. This should would work for your case, then:

install.packages("Rmpfr",
  configure.args = c(Rmpfr = "--with-mpfr-include=/path/to/mpfr/include"))
tomshafer
  • 795
  • 3
  • 8
  • 12