[R] "ignoring environment value of R_HOME" error when installing packages

tub78 stu.andrews at gmail.com
Wed Jun 4 06:35:41 CEST 2008

I am troubled by what appears to be a glitch in the current
distribution, or in
its installation on our system.  I've traced it, and found a work-
around.  Is
this normal?  Is there a cleaner solution?

The problem:

During a package installation, the warning message "WARNING: ignoring
environment value of R_HOME" from line 31 of <R_HOME>/bin/R is
spliced into the CLINK_CPPFLAGS variable at line 606 of <R_HOME>/bin/
This prevents the compilation C files.  Please note that I have not
set the R_HOME
environment variable; it is undefined in my shell.

- Here are lines 29-32 from <R_HOME>/bin/R:

if test -n "${R_HOME}" && \
   test "${R_HOME}" != "${R_HOME_DIR}"; then
  echo "WARNING: ignoring environment value of R_HOME"

- Here is line 606 of <R_HOME>/bin/INSTALL:

"tools:::.find_cinclude_paths(file='DESCRIPTION')" | \
      "${R_EXE}" --vanilla --slave`

The work-around:

First some background.  The command sequence "R CMD INSTALL" sets in
motion a sequence of scripts that collectively manage the installation

    "R"        <R_HOME>/bin/R              calls Rcmd script on line
    "CMD"      <R_HOME>/lib/R/bin/Rcmd     calls INSTALL script on
line 45
    "INSTALL"  <R_HOME>/lib/R/bin/INSTALL  encounters the error on
line 606

Now, if you are the owner of you installation, then you can probably
just edit
the INSTALL file directly.

Otherwise, if you specify the full path of an executable in place of
the word
"INSTALL" on the command line, the Rcmd script will detect this and
call your
script instead of the normal INSTALL script (see Rcmd line 37).

    e.g.  "R CMD <path.to.alternate.install.script> ..."

One can just copy the INSTALL script, changing line 606 to
and hope for the best.  If the package you are compiling specifies its
own C
include files, then you will have to modify the variable accordingly,
or else
use the ~/.R/Makevars mechanism.

But, the question remains, is there an nicer solution?

- Stu

More information about the R-help mailing list