0

There are several reports for this issue all dating 2 to 3 years back:

caught segfault error in R

Problems loading packages (ie. ggplot2) on R 3.2.2 caught segfault address 0x18, cause 'memory not mapped' [duplicate]

Most of them are referring to older system versions and older ggplot2 version. I'm wondering if anybody found alternative solution to the suggested R re-installation (which apparently did not work for everyone)?

I'm on Mac 10.11.6 and when trying to install ggplot2 either from within or outside of R (R CMD INSTALL) I get segfault:

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

The same can be reproduced using ggplot2 versions:

1.0.0, 1.0.1, 2.0.0, 2.1.0, 2.2.0

I tested that on fresh R-3.3.2 session. The error occurs during installation, not during loading.

Traceback received:

 Traceback:
 1: dyn.load(file, DLLpath = DLLpath, ...)
 2: library.dynam(lib, package, package.lib)
 3: loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]])
 4: asNamespace(ns)
 5: namespaceImportFrom(ns, loadNamespace(j <- i[[1L]], c(lib.loc,     .libPaths()), versionCheck = vI[[j]]), i[[2L]], from = package)
 6: loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]])
 7: namespaceImport(ns, loadNamespace(i, c(lib.loc, .libPaths()),     versionCheck = vI[[i]]), from = package)
 8: loadNamespace(package, lib.loc, keep.source, partial = TRUE)
 9: withCallingHandlers(expr, packageStartupMessage = function(c) invokeRestart("muffleMessage"))
10: suppressPackageStartupMessages(loadNamespace(package, lib.loc,     keep.source, partial = TRUE))
11: code2LazyLoadDB(package, lib.loc = lib.loc, keep.source = keep.source,     compress = compress)
12: makeLazyLoading(pkg_name, lib, keep.source = keep.source)
13: doTryCatch(return(expr), name, parentenv, handler)
14: tryCatchOne(expr, names, parentenv, handlers[[1L]])
15: tryCatchList(expr, classes, parentenv, handlers)
16: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call)[1L]        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        msg <- conditionMessage(e)        sm <- strsplit(msg, "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")        if (w > LONG)             prefix <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && identical(getOption("show.error.messages"),         TRUE)) {        cat(msg, file = stderr())        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
17: try({    suppressPackageStartupMessages(.getRequiredPackages(quietly = TRUE))    makeLazyLoading(pkg_name, lib, keep.source = keep.source)})
18: do_install_source(pkg_name, instdir, pkg, desc)
19: do_install(pkg)
20: tools:::.install_packages()
An irrecoverable exception occurred. R is aborting now ...
/Users/username/miniconda3/lib/R/bin/INSTALL: line 34:  2049 Done                    echo 'tools:::.install_packages()'
      2050 Segmentation fault: 11  | R_DEFAULT_PACKAGES= LC_COLLATE=C "${R_HOME}/bin/R" $myArgs --slave --args ${args}

The reproduce, start new R session and install 'ggplot2' with:

$ R
> install.packages('ggplot2')

Session info:

> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin11.4.2 (64-bit)
Running under: OS X 10.11.6 (El Capitan)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

Any suggestions would be appreciated.

Community
  • 1
  • 1
mjp
  • 215
  • 2
  • 11
  • What code are you running exactly that causes the error? A [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) would be helpful as well as the complete `sessionInfo()`. What's the output before the error? – MrFlick May 08 '17 at 19:19
  • I updated the question as suggested. There is not much output before that error but there is traceback that I added to the question. – mjp May 08 '17 at 19:56
  • Is this specific to ggplot2 or is it the same for all packages you try to install? Maybe try running `chooseCRANmirror(FALSE)` before hand. Maybe it's having a problem trying to open a dialog to choose a CRAN mirror. – MrFlick May 08 '17 at 19:59
  • I don't think it's ggplot2 specific as downgrading it to version 1.0.0 still triggered the error and I was able to use it in the past. There is no problem choosing the mirror. The good news is: I was able to overcome this by downgrading R to 3.2.2. Only then I was able to successfully install and load ggplot2. – mjp May 09 '17 at 11:49
  • If you feel the title should be amended, if I can, I would be happy to do that. – mjp May 09 '17 at 12:14

0 Answers0