[R-pkg-devel] How to debug segfault when running build -> document in Rstudio that includes TMB module

James Lamb j@y|@mb20 @end|ng |rom gm@||@com
Wed Jan 24 04:35:31 CET 2024


Carl,

Consider performing these tasks without the use of the 'devtools' package,
running the following from a shell.

```shell
R CMD build .
R CMD INSTALL --with-keep.source ./SPAS_*.tar.gz

# (assuming you use roxygen2)
Rscript -e "roxygen2::roxygenize(load = 'installed')"

R CMD check --as-cran ./SPAS_*.tar.gz
```

If those commands are successful, then you know the problem lies somewhere
in the difference between that approach and what 'devtools' does, which
might help to narrow it down.

Cheers,

-James


On Tue, Jan 23, 2024 at 9:23 PM Carl Schwarz <cschwarzstatsfuca using gmail.com>
wrote:

> I'm trying to update my SPAS package to respond to a CRAN check. Before
> starting the changes, I tried to rebuild my package, but now get a segfault
> when I try to do a devtools::document() or devtools::check(args =
> c('--as-cran')). See below for output from the Rstudio "Build" window.
>
> I've
> - reinstalled ALL packages
> - reinstalled R (4.3.2 on MacOS Intel Chip)
> - reinstalled Rstudio
>
> When I try a rebuild/document on a sister package it runs fine, so I
> suspect that the problem is related to using a TMB module that is part of
> the SPAS package written in Cpp.
>
> How do I start to "debug" this to identify the problem?
>
> Thanks
> Carl Schwarz
>
>
>
>
> ==> devtools::document(roclets = c('rd', 'collate', 'namespace',
> 'vignette'))
> ℹ Updating SPAS documentationℹ Loading SPAS
>
>  *** caught segfault ***
> address 0x54e40, cause 'memory not mapped'
>
> Traceback:
>  1: dyn.load(dll_copy_file)
>  2: library.dynam2(path, lib)
>  3: load_dll(path)
>  4: pkgload::load_all(path, helpers = FALSE, attach_testthat = FALSE)
>  5: load_code(base_path)
>  6: roxygen2::roxygenise(pkg$path, roclets)
>  7: devtools::document(roclets = c("rd", "collate", "namespace",
> "vignette"))
>  8: withCallingHandlers(expr, packageStartupMessage = function(c)
> tryInvokeRestart("muffleMessage"))
>  9: suppressPackageStartupMessages({    oldLC <-
> Sys.getlocale(category = "LC_COLLATE")    Sys.setlocale(category =
> "LC_COLLATE", locale = "C")    on.exit(Sys.setlocale(category =
> "LC_COLLATE", locale = oldLC))    devtools::document(roclets = c("rd",
> "collate", "namespace",         "vignette"))})
> An irrecoverable exception occurred. R is aborting now ...
>
> Exited with status 139.
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>


-- 
James Lamb (he/him)
GitHub <https://github.com/jameslamb> | LinkedIn
<https://www.linkedin.com/in/jameslamb1/>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list