[Rcpp-devel] memory not mapped with Rcpp on Ubuntu
Serguei Sokol
serguei.sokol at gmail.com
Thu Feb 13 16:23:12 CET 2025
Hi John,
Le 13/02/2025 à 15:17, John Clarke a écrit :
> Hey folks,
>
> I've been developing an Rcpp package on my Mac and testing on Mac and
> Windows. I also have been testing on linux-latest with the standard
> Github action which runs the CMD check. These passed without any problem
> until I implemented a test suite (testthat) and increased the test
> coverage to include additional calls. It turns out that the two main
> functions (and maybe others) that I wrote cause a segfault on Ubuntu
> builds. Several versions on Linux are tested and all fail.
>
> It appears to be related to Rcpp so I'm wondering if you've encountered
> this before and how I might go about finding a solution. I can reproduce
> the error on a local docker image consistently, but... I don't have the
> debugging tools I"m used to on MacOS via VS Code to help me step through
> when the error occurs. And I suspect it has to do with a mismatched
> library version because the tests pass fine on Windows and MacOS. So not
> sure if debugging would help much.
>
> Is there a known configuration/compiling issue/fix that I could try?
You can see some techniques e.g. here
https://github.com/wch/r-debug/blob/master/debugging-r.md
In short, if you already have a docker image, you can compile you code
there with "-g -O0" options and run it in:
R -d gdb
(gdb) run
<run your R/Rcpp (test)code. An error will bring you back to gdb where
you can check relevant frames, parameters, cals and so on.>
Hoping it helps,
Best,
Serguei.
> Apart from installing a full fledged instance of Ubuntu with VS Code and
> debugger, is there a way I can get closer to finding out what the issue is?
>
> Clip from the failed R error messages when I call
> shg$runSimFromFixedValues(N, 0, 0, 1940):
>
> *** caught segfault ***
> address (nil), cause 'memory not mapped'
>
> Traceback:
> 1: .External(list(name = "CppMethod__invoke_notvoid", address =
> <pointer: 0x55efab6ef710>, dll = list(name = "Rcpp", path = "/usr/
> local/lib/R/site-library/Rcpp/libs/Rcpp.so", dynamicLookup =
> TRUE, handle = <pointer: 0x55efa9b64b30>, info = <pointer:
> 0x55efaa89aaa0>, forceSymbols = FALSE), numParameters = -1L),
> <pointer: 0x55efae9ae1f0>, <pointer: 0x55efaf2399d0>, .pointer, ...)
> 2: shg$runSimFromFixedValues(N, 0, 0, 1940)
>
> Thanks,
>
> -John
>
> John Clarke | Senior Technical Advisor |
> Cornerstone Systems Northwest | john.clarke at cornerstonenw.com
> <mailto:john.clarke at cornerstonenw.com>
>
> _______________________________________________
> 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
More information about the Rcpp-devel
mailing list