From romain at r-enthusiasts.com  Thu May 20 10:03:10 2010
From: romain at r-enthusiasts.com (Romain Francois)
Date: Thu, 20 May 2010 10:03:10 +0200
Subject: [Rd] Use of R and Rscript in configure/Makevars in packages
In-Reply-To: <alpine.LFD.2.00.1005200839150.9004@gannet.stats.ox.ac.uk>
References: <alpine.LFD.2.00.1005121542130.12002@gannet.stats.ox.ac.uk>
	<4BF4E2CC.7010501@r-enthusiasts.com>
	<alpine.LFD.2.00.1005200839150.9004@gannet.stats.ox.ac.uk>
Message-ID: <4BF4ECBE.8030208@r-enthusiasts.com>

Le 20/05/10 09:40, Prof Brian Ripley a ?crit :
> 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.

Sure. This leaves plently of time to test it then.

Reading the above literally, I will not work on a patch, but I can offer 
my time to test it if someone in R-core does volunteer.

Romain

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


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



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