R3.5 and R4.0.1 on RHEL 7, GCC 7.2, ignoring environment value of R_HOME, segfault w gcc 11.2
On RHEL 7.5 with Bright Cluster Manager, which allows loading of different versions of packages via a module load command, and rstan fails to compile with R3.5.1 and R4.0.1. but does compile with R4.1
R/3.5.1 and gcc/7.2.0
/path/to/3.5/RcppEigen/include/Eigen/src/Core/CoreEvaluators.h:989:54: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits
R/4.0.1 and gcc/7.2.0
Error: C++14 standard requested but CXX14 is not defined
R/4.0.1 and gcc/11.2.0
** testing if installed package can be loaded from temporary location
sh: line 1: 293237 Segmentation fault R_TESTS= '/path/to/R/bin/R' --no-save --no-restore --no-echo 2>&1 < '/tmp/RtmpZdP7sv/file47397117b9cf'
*** caught segfault ***
address 0x20, cause 'memory not mapped'
Traceback:
1: Module(module, mustStart = TRUE, where = env)
2: doTryCatch(return(expr), name, parentenv, handler)
3: tryCatchOne(expr, names, parentenv, handlers[[1L]])
4: tryCatchList(expr, classes, parentenv, handlers)
5: tryCatch(Module(module, mustStart = TRUE, where = env), error = function(e) e)
6: Rcpp::loadModule("class_model_base", what = TRUE)
7: fun(libname, pkgname)
8: doTryCatch(return(expr), name, parentenv, handler)
9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
10: tryCatchList(expr, classes, parentenv, handlers)
11: tryCatch(fun(libname, pkgname), error = identity)
12: runHook(".onLoad", env, package.lib, package)
13: loadNamespace(package, lib.loc)
14: doTryCatch(return(expr), name, parentenv, handler)
15: tryCatchOne(expr, names, parentenv, handlers[[1L]])
16: tryCatchList(expr, classes, parentenv, handlers)
17: tryCatch({ attr(package, "LibPath") <- which.lib.loc ns <- loadNamespace(package, lib.loc) env <- attachNamespace(ns, pos = pos, deps, exclude, include.only)}, error = function(e) { P <- if (!is.null(cc <- conditionCall(e))) paste(" in", deparse(cc)[1L]) else "" msg <- gettextf("package or namespace load failed for %s%s:\n %s", sQuote(package), P, conditionMessage(e)) if (logical.return) message(paste("Error:", msg), domain = NA) else stop(msg, call. = FALSE, domain = NA)})
18: library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE)
19: withCallingHandlers(expr, packageStartupMessage = function(c) tryInvokeRestart("muffleMessage"))
20: suppressPackageStartupMessages(library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE))
21: doTryCatch(return(expr), name, parentenv, handler)
22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
23: tryCatchList(expr, classes, parentenv, handlers)
24: 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))})
25: try(suppressPackageStartupMessages(library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE)))
26: tools:::.test_load_package("rstan", "/moto/home/rk3199/R/x86_64-pc-linux-gnu-library/4.0/00LOCK-rstan/00new")
An irrecoverable exception occurred. R is aborting now ...
ERROR: loading failed
R4.1:
> library(rstan)
Loading required package: StanHeaders
Loading required package: ggplot2
rstan (Version 2.21.3, GitRev: 2e1f913d3ca3)
For execution on a local, multicore CPU with excess RAM we recommend calling
options(mc.cores = parallel::detectCores()).
To avoid recompilation of unchanged Stan programs, we recommend calling
rstan_options(auto_write = TRUE)
.R/Makevars
CXX14FLAGS=-O3 -march=native -mtune=native -fPIC
CXX14FLAGS+= -Wno-unused-variable -Wno-unused-function
CXX14 = g++ -std=c++1y
Is there any option I'm missing here to get this running on R3.5?
Edit: Update, using GCC11.2 and installing the 'Rcpp' package I was able to get rstan to work on R4.0.1. Any work arounds for R 3.5?