[Bioc-devel] Rscript on Bioconductor test servers

Seth Falcon sfalcon at fhcrc.org
Mon Jan 4 18:38:22 CET 2010

Hi Henning,

On 1/3/10 6:12 PM, Henning Redestig wrote:
> 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?

It seems like this should be a case where LinkingTo should help you.
 From Writing R Extensions:

* WRE 5.4 Registering native routines
> A package that wishes to make use of header files in other packages
> needs to declare them as a comma-separated list in the field
> LinkingTo in the DESCRIPTION file. For example
> Depends: link2, link3 LinkingTo: link2, link3
> It should also `Depend' on those packages for they have to be
> installed prior to this one, and loaded prior to this one (so the
> path to their compiled code can be found).
> This then arranges that the include directories in the installed
> linked-to packages are added to the include paths for C and C++ code.

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

Seth Falcon
Program in Computational Biology | Fred Hutchinson Cancer Research Center

More information about the Bioc-devel mailing list