[Rcpp-devel] segfault for simple Rcpp module
Dirk Eddelbuettel
edd at debian.org
Sat May 5 12:51:41 CEST 2012
Hi Jiqiang,
Thanks for the very detailed report. I can confirm the seg.fault using R
2.15.0 and our current Rcpp snapshot:
R> library(Rcpp)
R> library(rcppapp1)
R> m1 <- Module('yada', 'rcppapp1')
R> m1$hello()
*** caught segfault ***
address 0x90, cause 'memory not mapped'
Traceback:
1: .Call(symbol)
2: Module(module, mustStart = TRUE)
3: .getModulePointer(x)
4: m1$hello
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection: 3
edd at max:/tmp$
Some things are changing how modules are loaded. I hope Romain can take a
look at it.
It is best to ignore this use case now. Other things do work -- look at the
unit test examples and its modules use case.
Off running now, Dirk
On 5 May 2012 at 00:51, Jiqiang Guo wrote:
| I was learning Rcpp and got the following problem in a basic example.
| I have searched online and knew someone have the same problem before,
| but did not find a good answer for this.
|
| Simply put, I am running the following script:
|
| rm -rf rcppapp1
| R -q -e "library(Rcpp); Rcpp.package.skeleton(name = 'rcppapp1', module =
| TRUE);sessionInfo()"
| R CMD build rcppapp1
| R CMD INSTALL rcppapp1
| R -q -e "require(Rcpp);require('rcppapp1');m1<-Module('yada', 'rcppapp1');m1\
| $hello()"
|
|
| But I could not run the hello function defined in the model yada.
| Here is the output:
|
| + rm -rf rcppapp1
| + R -q -e 'library(Rcpp); Rcpp.package.skeleton(name = '\''rcppapp1'\'', module
| = TRUE);sessionInfo()'
| > library(Rcpp); Rcpp.package.skeleton(name = 'rcppapp1', module = TRUE);
| sessionInfo()
| Creating directories ...
| Creating DESCRIPTION ...
| Creating NAMESPACE ...
| Creating Read-and-delete-me ...
| Saving functions and data ...
| Making help files ...
| Done.
| Further steps are described in './rcppapp1/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 version 2.15.0 (2012-03-30)
| Platform: x86_64-pc-linux-gnu (64-bit)
|
| locale:
| [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=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
| [7] LC_PAPER=C LC_NAME=C
| [9] LC_ADDRESS=C LC_TELEPHONE=C
| [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
|
| attached base packages:
| [1] stats graphics grDevices utils datasets methods base
|
|
| other attached packages:
| [1] Rcpp_0.9.10
| >
| >
| + R CMD build rcppapp1
| * checking for file ‘rcppapp1/DESCRIPTION’ ... OK
| * preparing ‘rcppapp1’:
| * checking DESCRIPTION meta-information ... OK
| * cleaning src
| * checking for LF line-endings in source and make files
| * checking for empty or unneeded directories
| * building ‘rcppapp1_1.0.tar.gz’
|
| + R CMD INSTALL rcppapp1
| * installing to library ‘/usr/local/lib/R/site-library’
| * installing *source* package ‘rcppapp1’ ...
| ** libs
| g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/
| include" -fpic -O3 -pipe -g -c rcpp_hello_world.cpp -o
| rcpp_hello_world.o
| g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/
| include" -fpic -O3 -pipe -g -c rcpp_module.cpp -o rcpp_module.o
| g++ -shared -o rcppapp1.so rcpp_hello_world.o rcpp_module.o -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/rcppapp1/libs
| ** R
| ** preparing package for lazy loading
| ** help
| Warning: /home/jq/Desktop/bitbucket/yabbrep/myrstan/rcppapp1/man/
| rcppapp1-package.Rd:31: All text must be in a section
| Warning: /home/jq/Desktop/bitbucket/yabbrep/myrstan/rcppapp1/man/
| rcppapp1-package.Rd:32: All text must be in a section
| *** installing help indices
| ** building package indices
| ** testing if installed package can be loaded
|
| * DONE (rcppapp1)
| + R -q -e 'require(Rcpp);require('\''rcppapp1'\'');m1<-Module('\''yada'\'', '\
| ''rcppapp1'\'');m1$hello()'
| > require(Rcpp);require('rcppapp1');m1<-Module('yada', 'rcppapp1');m1$hello()
| Loading required package: Rcpp
| Loading required package: rcppapp1
|
| *** caught segfault ***
| address 0x90, cause 'memory not mapped'
|
| Traceback:
| 1: .Call(symbol)
| 2: Module(module, mustStart = TRUE)
| 3: .getModulePointer(x)
| 4: m1$hello
| aborting ...
|
|
| Thanks!
| J
|
| ----------------------------------------------------------------------
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
--
R/Finance 2012 Conference on May 11 and 12, 2012 at UIC in Chicago, IL
See agenda, registration details and more at http://www.RinFinance.com
More information about the Rcpp-devel
mailing list