Sorry, but that's just me being lazy with my lib directory. When I start R back up in my example, you'll see it's 2.13.1. <br><br><div class="gmail_quote">On Fri, Aug 12, 2011 at 6:07 AM, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org">edd@debian.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
Hi Chris,<br>
<div><div></div><div class="h5"><br>
On 11 August 2011 at 22:23, Chris DuBois wrote:<br>
| Hi all,<br>
|<br>
| I've created a package using Rcpp.package.skeleton("pkg",module=TRUE). <br>
|<br>
| If I create a file R/hello_world2.R with the following<br>
|<br>
| show(World)<br>
| b <- new(World)<br>
| b$greet()<br>
| b$set("hello everybody")<br>
| b$greet()<br>
| rm(b)<br>
|<br>
| then I receive an "execution halted" error when I try to compile the package<br>
| using R CMD INSTALL pkg. Why is this? <br>
|<br>
| I've included my steps below.<br>
|<br>
| > library(Rcpp) # latest version from CRAN<br>
| > Rcpp.package.skeleton("pkg",module=TRUE)<br>
| Creating directories ...<br>
| Creating DESCRIPTION ...<br>
| Creating NAMESPACE ...<br>
| Creating Read-and-delete-me ...<br>
| Saving functions and data ...<br>
| Making help files ...<br>
| Done.<br>
| Further steps are described in './pkg/Read-and-delete-me'.<br>
|<br>
| Adding Rcpp settings<br>
| >> added RcppModules: yada<br>
| >> added Depends: Rcpp<br>
| >> added LinkingTo: Rcpp<br>
| >> added useDynLib directive to NAMESPACE<br>
| >> added Makevars file with Rcpp settings<br>
| >> added Makevars.win file with Rcpp settings<br>
| >> added example header file using Rcpp classes<br>
| >> added example src file using Rcpp classes<br>
| >> added example R file calling the C++ example<br>
| >> added Rd file for rcpp_hello_world<br>
| >> copied the example module <br>
| > q()<br>
| Save workspace image? [y/n/c]: n<br>
| chris@seldon:~/Documents/networkstats$ R CMD INSTALL pkg<br>
| * installing to library ‘/home/chris/R/i486-pc-linux-gnu-library/2.10’<br>
<br>
</div></div>Rcpp has dependended on R (>= 2.12) for quite some time, and Module<br>
definitely requires it.<br>
<br>
How did you get Rcpp installed on that version of R, and what version of Rcpp<br>
is it?<br>
<br>
Something like the example you show here is part of the unit tests and<br>
clearly works with current R and Rcpp versions. Can you get hold of a newer<br>
R somewhere to try it?<br>
<br>
Dirk<br>
<div><div></div><div class="h5"><br>
| * installing *source* package ‘pkg’ ...<br>
| ** libs<br>
| g++ -I/usr/share/R/include -I"/home/chris/R/i486-pc-linux-gnu-library/2.10/<br>
| Rcpp/include" -fpic -O3 -pipe -g -c rcpp_hello_world.cpp -o<br>
| rcpp_hello_world.o<br>
| g++ -I/usr/share/R/include -I"/home/chris/R/i486-pc-linux-gnu-library/2.10/<br>
| Rcpp/include" -fpic -O3 -pipe -g -c rcpp_module.cpp -o rcpp_module.o<br>
| g++ -shared -o pkg.so rcpp_hello_world.o rcpp_module.o -L/home/chris/R/<br>
| i486-pc-linux-gnu-library/2.10/Rcpp/lib -lRcpp -Wl,-rpath,/home/chris/R/<br>
| i486-pc-linux-gnu-library/2.10/Rcpp/lib -L/usr/lib/R/lib -lR<br>
| installing to /home/chris/R/i486-pc-linux-gnu-library/2.10/pkg/libs<br>
| ** R<br>
| ** preparing package for lazy loading<br>
| ** help<br>
| Warning: /home/chris/Documents/networkstats/pkg/man/pkg-package.Rd:32: All text<br>
| must be in a section<br>
| Warning: /home/chris/Documents/networkstats/pkg/man/pkg-package.Rd:33: All text<br>
| must be in a section<br>
| *** installing help indices<br>
| ** building package indices ...<br>
| ** testing if installed package can be loaded<br>
|<br>
| * DONE (pkg)<br>
| chris@seldon:~/Documents/networkstats$ R<br>
| R version 2.13.1 (2011-07-08)<br>
| > library(pkg)<br>
| Loading required package: Rcpp<br>
| > source("pkg/R/rcpp_hello_world.R")<br>
| > rcpp_hello_world() # works as expected<br>
| [[1]]<br>
| [1] "foo" "bar"<br>
|<br>
| [[2]]<br>
| [1] 0 1<br>
| > q()<br>
| chris@seldon:~/Documents/networkstats$ cp rcpp_hello_world2.R pkg/R/<br>
| chris@seldon:~/Documents/networkstats$ R CMD INSTALL pkg<br>
| * installing to library ‘/home/chris/R/i486-pc-linux-gnu-library/2.10’<br>
| * installing *source* package ‘pkg’ ...<br>
| ** libs<br>
| make: Nothing to be done for `all'.<br>
| installing to /home/chris/R/i486-pc-linux-gnu-library/2.10/pkg/libs<br>
| ** R<br>
| ** preparing package for lazy loading<br>
| Execution halted<br>
|<br>
|<br>
</div></div>| ----------------------------------------------------------------------<br>
| _______________________________________________<br>
| Rcpp-devel mailing list<br>
| <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
| <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
<font color="#888888"><br>
--<br>
Two new Rcpp master classes for R and C++ integration scheduled for<br>
New York (Sep 24) and San Francisco (Oct 8), more details are at<br>
<a href="http://dirk.eddelbuettel.com/blog/2011/08/04#rcpp_classes_2011-09_and_2011-10" target="_blank">http://dirk.eddelbuettel.com/blog/2011/08/04#rcpp_classes_2011-09_and_2011-10</a><br>
<a href="http://www.revolutionanalytics.com/products/training/public/rcpp-master-class.php" target="_blank">http://www.revolutionanalytics.com/products/training/public/rcpp-master-class.php</a><br>
</font></blockquote></div><br>