[Rcpp-devel] question re: LdFlags, RcppLdFlags

Dirk Eddelbuettel edd at debian.org
Thu Oct 10 02:41:29 CEST 2013


(Combining two of your emails)

On 10 October 2013 at 01:08, Romain Francois wrote:
| RcppGSL does not export its LdFlags, if it did, you'd see the warning 
| when you load it.

Good catch ... but turns out I don't (to my surprise).

It seems to work. Maybe NAMESPACE really do help.  Full log at bottom.
 
| Why would you import Rcpp's LdFlags inside RcppGSL's namespace, you 
| don't use it there.

R CMD check did complain, I guess it must grep for src/ to find it in
Makevars. Once I imported the complaint went away.

On 10 October 2013 at 01:18, Romain Francois wrote:
| > That's pretty.  For all the Rcpp-using package, we can assume Rcpp to be
| > there so it may as well pivot over and call a plugin from 'foo'.
| 
| I think it is worth looking in that direction.

We'll see if we need it. Kevin's point etc.
 
| > The other immediate defensive way would be to use NAMESPACE etc on the client
| > package and not load Rcpp and Rcpp$foo but just importFrom() etc what is needed.
| 
| Maybe that works.

Generally speaking, and as I understand recent r-devel threads, Imports: and
importFrom(...) is how we are supposed to work with NAMESPACEs now.  That is
also what I did here, and what you roundly mocked one email ago (see above).

I am sure we'll find a way to sort it all out. 

Dirk

Log below

edd at max:~/svn/rcpp/pkg$ svn di RcppGSL     ## now exporting LdFlags in RcppGSL
Index: RcppGSL/NAMESPACE
===================================================================
--- RcppGSL/NAMESPACE	(revision 4567)
+++ RcppGSL/NAMESPACE	(working copy)
@@ -3,7 +3,8 @@
 importFrom(utils,assignInNamespace)
 importFrom(Rcpp,LdFlags)
 export(fastLmPure,
-       fastLm)
+       fastLm,
+       LdFlags)
 S3method(fastLm, default)
 S3method(fastLm, formula)
 S3method(predict, fastLm)
edd at max:~/svn/rcpp/pkg$ R CMD INSTALL RcppGSL_0.2.0.3.tar.gz ## using rebuilt tar.gz
* installing to library ‘/usr/local/lib/R/site-library’
* installing *source* package ‘RcppGSL’ ...
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for gsl-config... /usr/bin/gsl-config
checking for Rscript... yes
configure: creating ./config.status
config.status: creating src/Makevars
** libs
ccache g++-4.7 -I/usr/share/R/include -DNDEBUG -I/usr/include -I../inst/include  -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -g -O3 -Wall -pipe -Wno-unused -pedantic  -c fastLm.cpp -o fastLm.o
g++-4.7 -shared -o RcppGSL.so fastLm.o -L/usr/lib -lgsl -lgslcblas -lm -L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/RcppGSL/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (RcppGSL)
edd at max:~/svn/rcpp/pkg$ R

R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.


Careful now, or I'll get into a rant about how much you pay for ArcGIS and whether you are getting value for money if bugs become 'well-known'! Bugs in R
tend to be either 'obscure' or 'fixed' :)
   -- Barry Rowlingson (in response to a request for rgdal to work around a well-known bug in ArcGIS)
      R-SIG-Geo (March 2012)

R> library(RcppGSL)          ## no warning !!
R> LdFlags                   ## local 
function (print = TRUE) 
{
    if (print) 
        cat(.pkgglobalenv$gsl_libs)
    else .pkgglobalenv$gsl_libs
}
<environment: namespace:RcppGSL>
R> Rcpp::LdFlags             ## remote from Rcpp
function (static = staticLinking()) 
{
    cat(RcppLdFlags(static = static))
}
<environment: namespace:Rcpp>
R> 

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list