easybuilders / easybuild-easyconfigs

A collection of easyconfig files that describe which software to build using which build options with EasyBuild.
https://easybuild.io
GNU General Public License v2.0
380 stars 704 forks source link

segfault during installation of gWidgets2tcltk extension in R 4.0.x easyconfigs when fonts are missing on system #11917

Open zao opened 3 years ago

zao commented 3 years ago

The installation for gWidgets2tcltk is run via xvfb-run and crashes with a segmentation fault like this if run standalone:

* installing *source* package ‘gWidgets2tcltk’ ...
** package ‘gWidgets2tcltk’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** demo
** inst
** byte-compile and prepare package for lazy loading

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

Traceback:
 1: structure(.External(.C_dotTclObjv, objv), class = "tclObj")
 2: .Tcl.objv(.Tcl.args.objv(...))
 3: tcl("font", "measure", "TkTextFont", "0")
 4: tclvalue(tcl("font", "measure", "TkTextFont", "0"))
 5: eval(exprs[i], envir)
 6: eval(exprs[i], envir)
 7: sys.source(codeFile, env, keep.source = keep.source, keep.parse.data = keep.parse.data)
 8: doTryCatch(return(expr), name, parentenv, handler)
 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
10: tryCatchList(expr, classes, parentenv, handlers)
11: 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        sm <- strsplit(conditionMessage(e), "\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 && isTRUE(getOption("show.error.messages"))) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
12: try(sys.source(codeFile, env, keep.source = keep.source, keep.parse.data = keep.parse.data))
13: loadNamespace(package = package, lib.loc = lib.loc, keep.source = keep.source,     keep.parse.data = keep.parse.data, partial = TRUE)
14: withCallingHandlers(expr, packageStartupMessage = function(c) tryInvokeRestart("muffleMessage"))
15: suppressPackageStartupMessages(loadNamespace(package = package,     lib.loc = lib.loc, keep.source = keep.source, keep.parse.data = keep.parse.data,     partial = TRUE))
16: code2LazyLoadDB(package, lib.loc = lib.loc, keep.source = keep.source,     keep.parse.data = keep.parse.data, compress = compress, set.install.dir = set.install.dir)
17: tools:::makeLazyLoading("gWidgets2tcltk", "/import/easybuild/amd64_ubuntu1604_cfl/software/R/4.0.3-foss-2020b/lib/R/library/00LOCK-gWidgets2tcltk/00new",     keep.source = FALSE, keep.parse.data = FALSE, set.install.dir = "/import/easybuild/amd64_ubuntu1604_cfl/software/R/4.0.3-foss-2020b/lib/R/library/gWidgets2tcltk")
An irrecoverable exception occurred. R is aborting now ...
Segmentation fault (core dumped)
ERROR: lazy loading failed for package ‘gWidgets2tcltk’

See https://github.com/easybuilders/easybuild-easyconfigs/pull/11663#issuecomment-748937252 for the error when run as part of an EB build of R/4.0.3.

If I installed xterm on the system (with a fair number of dependencies) the installation of gWidgets2tcltk suddenly succeeds. The package that tipped the scales into working was fonts-dejavu-core, implying that something in the build hard-requires some sort of font presence.

zao commented 3 years ago

Additionally, on my system xvfb-run requires use of the -a argument to start at all.

akesandgren commented 3 years ago

fonts-dejavu-core installed solved the problem, no need for any other X-package.

robert-mijakovic commented 3 years ago

While working on a new R release, R-4.0.4, I have experienced probably a related issue that didn't result in the seg fault.

* installing *source* package gWidgets2tcltk ...
** package gWidgets2tcltk successfully unpacked and MD5 sums checked
** using staged installation
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") :
  [tcl] failed to allocate font due to internal system font engine problem.

Error: unable to load R code in package gWidgets2tcltk
Execution halted
ERROR: lazy loading failed for package gWidgets2tcltk

I will try to install the missing package. Let's see does this fixes the issue. EDIT: I have found that a similar issue happens in other packages, for PDE it is reported under section "Error when starting interactive user interface on Mac (failed to allocate tcl font)". However, the issue in my case happens on CentOS 8.3. https://cran.r-project.org/web/packages/PDE/readme/README.html

MohammadAliAmir commented 3 years ago

This error indeed gets solved by installing the dejavu font packages. Note: it is better to install more of them to ensure you have the correct packages. For CentOS 7, I installed the following packages: yum install bpg-dejavu-sans-fonts dejavu-fonts-common dejavu-lgc-sans-fonts dejavu-lgc-sans-mono-fonts dejavu-lgc-serif-fonts dejavu-sans-fonts dejavu-sans-mono-fonts dejavu-serif-fonts -y

asadstat commented 1 year ago

no DISPLAY variable so Tk is not available Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") : [tcl] invalid command name "font". Error: unable to load R code in package ‘gWidgets2tcltk’ Execution halted

asadstat commented 1 year ago

how can i solve this issue