[Rcpp-devel] Rcpp.package.create(attributes=TRUE)

Greg Minshall minshall at umich.edu
Wed Feb 27 05:00:34 CET 2013


Dirk,

> Show reprocucible errors, or the mail doesn't exist ;-)

works for me! (**) build the example skeleton with attributes=FALSE, "R
CMD build", install.packages(), library(), run rcpp_hello_world(), note
that a list with two items (each a 2 element vector) is returned.  (or,
just enter rcpp_hello_world to see its definition, and notice you get a
.Call().)

now, build with attributes=TRUE, run compileAttributes(), "R CMD build";
install.packages(), library(), run rcpp_hello_world(), and if it fails
NULL is returned.  (in this case, rcpp_hello_world will show an empty
function.)

it makes sense to me this would work (fail) this way, because both the
files in the anRpackage/R directory are defining the same global
(function) variable, i.e., rcpp_hello_world.  so, i assume whichever of
these two .R files is interpreted last when the package is loaded will
take precedence.

here's an example failure (and, two attachments that might reproduce, we
hope!).  did i mess up somehow?

cheers, Greg

(**) btw, i've *occasionally* (once, just when you asked for the
reproducible example! ;-) had the attributes=TRUE work.

----
Script started on Tue Feb 26 22:37:07 2013
bash greg-minshalls-mbp: {996} R

R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-apple-darwin12.2.1 (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.

> require(Rcpp)
Loading required package: Rcpp
> Rcpp.package.skeleton(attributes=TRUE)
Creating directories ...
Creating DESCRIPTION ...
Creating NAMESPACE ...
Creating Read-and-delete-me ...
Saving functions and data ...
Making help files ...
Done.
Further steps are described in './anRpackage/Read-and-delete-me'.

Adding Rcpp settings
 >> added Depends: Rcpp
 >> added LinkingTo: Rcpp
 >> added useDynLib directive to NAMESPACE
 >> added Makevars file with Rcpp settings
 >> added Makevars.win file with Rcpp settings
 >> added example src file using Rcpp attributes
 >> compiled Rcpp attributes
 >> added Rd file for rcpp_hello_world
> compileAttributes("
anRpackage/ typescript  
> compileAttributes("anRpackage/")
> 
bash greg-minshalls-mbp: {997} R CMD build anRpackage
* checking for file ‘anRpackage/DESCRIPTION’ ... OK
* preparing ‘anRpackage’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* building ‘anRpackage_1.0.tar.gz’

bash greg-minshalls-mbp: {998} R

R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-apple-darwin12.2.1 (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.

> install.packages("anRpackage_1.0.tar.gz")
Installing package(s) into ‘/Users/minshall/Library/R/2.15/library’
(as ‘lib’ is unspecified)
inferring 'repos = NULL' from the file name
* installing *source* package ‘anRpackage’ ...
** libs
flag-sort -r g++ -I/sw/Library/Frameworks/R.framework/Versions/2.15/Resources/include -DNDEBUG  -I/sw/include -I"/Users/minshall/Library/R/2.15/library/Rcpp/include"   -fPIC  -g -O2  -c RcppExports.cpp -o RcppExports.o
flag-sort -r g++ -I/sw/Library/Frameworks/R.framework/Versions/2.15/Resources/include -DNDEBUG  -I/sw/include -I"/Users/minshall/Library/R/2.15/library/Rcpp/include"   -fPIC  -g -O2  -c rcpp_hello_world.cpp -o rcpp_hello_world.o
flag-sort -r g++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/sw/lib -o anRpackage.dylib RcppExports.o rcpp_hello_world.o /Users/minshall/Library/R/2.15/library/Rcpp/lib/libRcpp.a -F/sw/Library/Frameworks/R.framework/.. -framework R -lintl -Wl,-framework -Wl,CoreFoundation
installing to /Users/minshall/Library/R/2.15/library/anRpackage/libs
** R
** preparing package for lazy loading
** help
Warning: /private/var/folders/qc/gxydc5q150qbr2mndftfyrmw0000gn/T/RtmpAZE0Z7/R.INSTALL75e2621598fb/anRpackage/man/anRpackage-package.Rd:31: All text must be in a section
Warning: /private/var/folders/qc/gxydc5q150qbr2mndftfyrmw0000gn/T/RtmpAZE0Z7/R.INSTALL75e2621598fb/anRpackage/man/anRpackage-package.Rd:32: All text must be in a section
*** installing help indices
** building package indices
** testing if installed package can be loaded

* DONE (anRpackage)
> require(anRpackage)
Loading required package: anRpackage
Loading required package: Rcpp
> rcpp_hello_world
function () 
{
}
<environment: namespace:anRpackage>
> rcpp_hello_world()
NULL
> 
bash greg-minshalls-mbp: {999} exit
exit

Script done on Tue Feb 26 22:38:26 2013
-------------- next part --------------
A non-text attachment was scrubbed...
Name: good.sh
Type: application/x-sh
Size: 210 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130226/70d6f49d/attachment.sh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bad.sh
Type: application/x-sh
Size: 276 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130226/70d6f49d/attachment-0001.sh>


More information about the Rcpp-devel mailing list