[Rcpp-devel] Rcpp Module Errors

Andrew Redd amredd at gmail.com
Wed Jun 22 00:51:12 CEST 2011

I apologize if this has been covered.  I've looked and see a couple of post
relating to this issue, but I'm not sure if it was ever solved. The example
modules appear to not work, at least for me.  On a related note I can't get
my modules to run either, but If I can figure out how to run the examples I
think I can get mine running.

R> sessionInfo()
R version 2.13.0 (2011-04-13)
Platform: x86_64-pc-linux-gnu (64-bit)

 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] Rcpp_0.9.4

To install the package skeleton:
$ r -lRcpp -e"Rcpp.package.skeleton(\"test\",module=T)"
Attaching package: 'utils'

The following object(s) are masked from 'package:Rcpp':

    .DollarNames, prompt

Creating directories ...
Creating DESCRIPTION ...
Creating NAMESPACE ...
Creating Read-and-delete-me ...
Saving functions and data ...
Making help files ...
Further steps are described in './test/Read-and-delete-me'.

Adding Rcpp settings
 >> added RcppModules: yada
 >> 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 header file using Rcpp classes
 >> added example src file using Rcpp classes
 >> added example R file calling the C++ example
 >> added Rd file for rcpp_hello_world
 >> copied the example module

$ R CMD build test
<<output omitted>>

and check with an error.
$R CMD check test_1.0.tar.gz
<<output omitted>>
* checking whether the name space can be loaded with stated dependencies ...
Error: .onLoad failed in loadNamespace() for 'test', details:
  call: value[[3L]](cond)
  error: failed to load module yada from package test
Execution halted

<<output omitted>>

According to Dirk's June 15th post on the issue I include require("methods",
character=TRUE, quietly=TRUE) in the .onLoad function, now checks ok but
when trying things out I get a segmentation fault.
$ R -q --vanilla
R> library(test)
Loading required package: Rcpp
R> Module('yada','test')$bla()

 *** caught segfault ***
address 0x90, cause 'memory not mapped'

 1: .Call(symbol)
 2: Module(module, mustStart = TRUE)
 3: .getModulePointer(x)
 4: Module("yada", "test")$bla

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace

So questions are:
    1) is anyone else getting this error?
    2) does anyone know how to fix it?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110621/c46dbcb3/attachment.htm>

More information about the Rcpp-devel mailing list