[Rd] Use of R and Rscript in configure/Makevars in packages

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu May 20 09:40:54 CEST 2010


On Thu, 20 May 2010, Romain Francois wrote:

> Hello,
>
> Thank you for these clear guidelines.
>
> Given these subtleties, would it make sense to have a "configure.R" that 
> would win over configure and configure.win, and have R invoking it correctly, 
> as below ?

Only if someone in R-core volunteers to implement it, and this would 
not solve the issue until R 2.12.0 and all the packages involved moved 
to it.

>
> Romain
>
> Le 20/05/10 08:51, Prof Brian Ripley a écrit :
>> 
>> We have seen problems with a number of packages which use R/Rscript to
>> run R code in configure or makefiles.
>> 
>> (a) You must give a full path: there need be no version of R in the
>> path, and if there is it might not be the version/build of R under which
>> package installation is being done. So the general form is to use
>> 
>> ${R_HOME}/bin/R
>> 
>> to select the right version. And since ${R_HOME} might contain spaces,
>> you need something like "${R_HOME}/bin/R".
>> 
>> There appear to be bare uses of Rscript in Rcpp RQuantLib bifactorial
>> mvabund, of bare R in ROracle pgfSweave rcom and many more packages
>> without quotes.
>> 
>> (b) There are further issues with platforms which use sub-architectures
>> (mainly Mac OS X and R-devel Windows). On Windows the
>> architecture-dependent executables will (as from R 2.12.0) be in
>> subdirectories of ${R_HOME}/bin, so the general form is to use one of
>> 
>> "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe"
>> "${R_HOME}/bin${R_ARCH_BIN}/Rterm.exe"
>> "${R_HOME}/bin${R_ARCH_BIN}/Rcmd.exe"
>> 
>> On R-devel Windows ${R_HOME}/bin/R.exe and ${R_HOME}/bin/Rscript.exe do
>> exist and are 32-bit executables whose sole task is to launch the
>> appropriate executable from a sub-directory. Since process creation is
>> expensive on Windows, this intermediate step is best avoided.
>> 
>> On Mac OS X, ${R_HOME}/bin/R is a script that launches the
>> architecture-dependent executables from a subdirectory, and on CRAN
>> builds ${R_HOME}/bin/Rscript is a 'fat' (multi-arch) executable, so the
>> issues have been worked around (but not necessarily for user installs).
>> 
>> (c) Calling R in configure.win will typically call 32-bit R with R-devel
>> Windows. If the result needs to depend on the architecture (and e.g. the
>> library dirs may well) then the work needs to be done in
>> src/Makevars.win: see the R-devel 'Writing R Extensions' manual for how
>> to achieve this.
>> 
>> (The reason is that configure.win is called once, and then
>> src/Makevars.win is called for each architecture.)
>> 
>> BDR
>> 
>
>
> -- 
> Romain Francois
> Professional R Enthusiast
> +33(0) 6 28 91 30 30
> http://romainfrancois.blog.free.fr
> |- http://bit.ly/bklUXt : RcppArmadillo 0.2.1
> |- http://bit.ly/936ck2 : Rcpp 0.8.0
> `- http://bit.ly/9aKDM9 : embed images in Rd documents
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


More information about the R-devel mailing list