Hi Serguei, Thank you! This didn't directly solve my problem, but it got me looking in the right direction. I ended up connecting to a docker container through VS Code on my host machine (Windows). I didn't wire up the debugger UI (which is really convenient in VS Code) but was able to identify the issue through the VS Code interface which is a lot easier to use than a bare terminal.
For the record the issue was a call to *fclose(pOutStream)* where pOutStream was Null. On Windows and MacOS this didn't seem to cause a problem, but in Ubuntu it failed. Sadly the traceback information was not precise enough to identify the offending line of code, so I had to find it iteratively. -John On Thu, Feb 13, 2025 at 4:23 PM Serguei Sokol <serguei.so...@gmail.com> wrote: > 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.cla...@cornerstonenw.com > > <mailto:john.cla...@cornerstonenw.com> > > > > _______________________________________________ > > Rcpp-devel mailing list > > Rcpp-devel@lists.r-forge.r-project.org > > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel > > _______________________________________________ > Rcpp-devel mailing list > Rcpp-devel@lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel >
_______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel