Skip to content

[Bioc-devel] Rscript on Bioconductor test servers

6 messages · Henning Redestig, Seth Falcon, Neumann, Steffen

#
Hi,

I have started to use the package Rcpp for simplified usage of C++
components (in the pcaMethods package). To build packages using Rcpp I
need to set the location of Rcpp.h. To do this in a reliable manner I
use a Makevars script containing

PKG_CPPFLAGS = $(shell Rscript -e 'Rcpp:::CxxFlags()')
PKG_LIBS = $(shell Rscript -e 'Rcpp:::LdFlags()')

but this fails on Bioconductors test servers with

make: Rscript: Command not found

Is Rscript not available on the test servers? If so, can we please
have it enabled?

cheers,
#
Hi Henning,
On 1/3/10 6:12 PM, Henning Redestig wrote:
It seems like this should be a case where LinkingTo should help you.
 From Writing R Extensions:

* WRE 5.4 Registering native routines
Your suggested solution has two potential problems:

1. You are proposing to use ":::" to access private functions from 
within a package.  If these functions are meant to be used outside of 
Rcpp, then they should be exported and then be accessible using "::".

2. Calling Rscript or even R without qualification can be a problem 
since it may not refer to the version of R that is doing the 
installation.  I will do some looking, but I think a better way would be 
to refer to $(R_HOME)/bin/R in Makevars.  You don't need Rscript for 
this, the following would work:

     $(R_HOME)/bin/R --slave -e "1:5"  # your code here

So please see if you can get things to work using LinkingTo and let's go 
from there.

+ seth
#
On Mon, 2010-01-04 at 09:38 -0800, Seth Falcon wrote:
Another, possibly suboptimal, solution is 
to include Rcpp.[ch] in your package, 
as in http://www.bioconductor.org/packages/stats/bioc/Rdisop.html

Yours,
Steffen
#
Hi Seth,

2010/1/5 Seth Falcon <sfalcon at fhcrc.org>:
According to the author of Rcpp, Dirk Eddelbuettel, this is tricky for C++.
What about using LinkingTo in the DESCRIPTION file?  Great
   question, but nobody has explained yet how to do that for C++. For
   C, we could do what lme4 and matrix do. But for C++? The 'name
   mangling' really gets in the way. Let us know if you know how to do this.

and therefore he suggests the Makevars script approach.
Good point, I have forwarded this to the Rcpp-devel list.
On my computer (ubuntu) I could get:

PKG_CPPFLAGS = $(shell $(R_HOME)/bin/R --slave -e 'Rcpp:::CxxFlags()')
PKG_LIBS = $(shell $(R_HOME)/bin/R --slave -e 'Rcpp:::LdFlags()')

to work, and am now waiting to see what Bioconductors servers think.

cheers,
1 day later
#
Just a conclusion to this matter, a Makevars script with

PKG_CPPFLAGS = $(shell $(R_HOME)/bin/R --slave -e 'Rcpp:::CxxFlags()')
PKG_LIBS = $(shell $(R_HOME)/bin/R --slave -e 'Rcpp:::LdFlags()')

and a Makevars.win with

PKG_CPPFLAGS = $(shell $(R_HOME)/bin/Rterm.exe --slave -e 'Rcpp:::CxxFlags()')
PKG_LIBS = $(shell $(R_HOME)/bin/Rterm.exe --slave -e 'Rcpp:::LdFlags()')

successfully sets the compiling flags for using Rcpp.

cheers,
#
On 1/6/10 4:36 PM, Henning Redestig wrote:
Glad you got things to work.
FWIW, I believe that you can use the $(R_HOME)/bin/R --slave -e 'blah' 
syntax on Windows too (works for me on XP w/ stock R 2-10.1).

+ seth