Weiming-Hu / AnalogsEnsemble

The C++ and R packages for parallel ensemble forecasts using Analog Ensemble
https://weiming-hu.github.io/AnalogsEnsemble/
MIT License
18 stars 5 forks source link

Installation error on Mac OS Catalina #102

Closed Weiming-Hu closed 4 years ago

Weiming-Hu commented 4 years ago

It happens again with Mac OS. I'm not sure whether this is related. But this morning I upgraded to Catalina. When I reinstall RAnEn, I have the following error.


R version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin18.6.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[Previously saved workspace restored]

> install.packages("https://github.com/Weiming-Hu/AnalogsEnsemble/raw/master/RAnalogs/releases/RAnEn_latest.tar.gz", repos = NULL)
Installing package into ‘/Users/wuh20/Library/R/3.6/library’
(as ‘lib’ is unspecified)
trying URL 'https://github.com/Weiming-Hu/AnalogsEnsemble/raw/master/RAnalogs/releases/RAnEn_latest.tar.gz'
Content type 'application/octet-stream' length 113271 bytes (110 KB)
==================================================
downloaded 110 KB

* installing *source* package ‘RAnEn’ ...
** using staged installation
Checking whether R_HOME is already set? R_HOME = /usr/local/Cellar/r/3.6.1_1/lib/R
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether clang++ -std=gnu++11 accepts -g... yes
checking for clang++ -std=gnu++11 option to support OpenMP... unsupported
configure: creating ./config.status
config.status: creating src/Makevars
** libs
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c AnEn.cpp -o AnEn.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c AnEnIS.cpp -o AnEnIS.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c AnEnSSE.cpp -o AnEnSSE.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c Array4DPointer.cpp -o Array4DPointer.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c BasicData.cpp -o BasicData.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c Calculator.cpp -o Calculator.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c Config.cpp -o Config.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c Forecasts.cpp -o Forecasts.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c ForecastsPointer.cpp -o ForecastsPointer.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c Functions.cpp -o Functions.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c Observations.cpp -o Observations.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c ObservationsPointer.cpp -o ObservationsPointer.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c Parameters.cpp -o Parameters.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c Profiler.cpp -o Profiler.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c RcppChecks.cpp -o RcppChecks.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c RcppConfig.cpp -o RcppConfig.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c RcppExports.cpp -o RcppExports.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c RcppForecasts.cpp -o RcppForecasts.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c RcppFunctions.cpp -o RcppFunctions.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c RcppGenerateAnalogs.cpp -o RcppGenerateAnalogs.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c RcppGenerateSearchStations.cpp -o RcppGenerateSearchStations.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c RcppGenerateTimeMapping.cpp -o RcppGenerateTimeMapping.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c RcppObservations.cpp -o RcppObservations.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c Stations.cpp -o Stations.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/Users/wuh20/Library/R/3.6/library/Rcpp/include" -I"/Users/wuh20/Library/R/3.6/library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -D_DISABLE_NON_HEADER_BOOST -fPIC  -g -O2  -c Times.cpp -o Times.o
clang++ -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -L/usr/local/Cellar/r/3.6.1_1/lib/R/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -o RAnEn.so AnEn.o AnEnIS.o AnEnSSE.o Array4DPointer.o BasicData.o Calculator.o Config.o Forecasts.o ForecastsPointer.o Functions.o Observations.o ObservationsPointer.o Parameters.o Profiler.o RcppChecks.o RcppConfig.o RcppExports.o RcppForecasts.o RcppFunctions.o RcppGenerateAnalogs.o RcppGenerateSearchStations.o RcppGenerateTimeMapping.o RcppObservations.o Stations.o Times.o -D_DISABLE_NON_HEADER_BOOST -L/usr/local/Cellar/r/3.6.1_1/lib/R/lib -lR -lintl -Wl,-framework -Wl,CoreFoundation
installing to /Users/wuh20/Library/R/3.6/library/00LOCK-RAnEn/00new/RAnEn/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
sh: line 1: 19408 Segmentation fault: 11  '/usr/local/Cellar/r/3.6.1_1/lib/R/bin/R' --no-save --slave 2>&1 < '/var/folders/z2/qq0ntf292kj8hy14ckfrmlp80000gp/T//Rtmpg6JJpJ/file484e318262f2'

 *** caught segfault ***
address 0x6d02, 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(module = "Config", what = TRUE, env = ns, loadNow = TRUE)
 7: (function (ns) Rcpp::loadModule(module = "Config", what = TRUE, env = ns, loadNow = TRUE))(<environment>)
 8: doTryCatch(return(expr), name, parentenv, handler)
 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
10: tryCatchList(expr, classes, parentenv, handlers)
11: tryCatch((function (ns) Rcpp::loadModule(module = "Config", what = TRUE, env = ns, loadNow = TRUE))(<environment>),     error = function(e) e)
12: eval(substitute(tryCatch(FUN(WHERE), error = function(e) e),     list(FUN = f, WHERE = where)), where)
13: eval(substitute(tryCatch(FUN(WHERE), error = function(e) e),     list(FUN = f, WHERE = where)), where)
14: .doLoadActions(where, attach)
15: methods::cacheMetaData(ns, TRUE, ns)
16: loadNamespace(package, lib.loc)
17: doTryCatch(return(expr), name, parentenv, handler)
18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
19: tryCatchList(expr, classes, parentenv, handlers)
20: 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)})
21: library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE)
22: withCallingHandlers(expr, packageStartupMessage = function(c) invokeRestart("muffleMessage"))
23: suppressPackageStartupMessages(library(pkg_name, lib.loc = lib,     character.only = TRUE, logical.return = TRUE))
24: doTryCatch(return(expr), name, parentenv, handler)
25: tryCatchOne(expr, names, parentenv, handlers[[1L]])
26: tryCatchList(expr, classes, parentenv, handlers)
27: 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))})
28: try(suppressPackageStartupMessages(library(pkg_name, lib.loc = lib,     character.only = TRUE, logical.return = TRUE)))
29: tools:::.test_load_package("RAnEn", "/Users/wuh20/Library/R/3.6/library/00LOCK-RAnEn/00new")
An irrecoverable exception occurred. R is aborting now ...
ERROR: loading failed
* removing ‘/Users/wuh20/Library/R/3.6/library/RAnEn’
* restoring previous ‘/Users/wuh20/Library/R/3.6/library/RAnEn’
Warning message:
In install.packages("https://github.com/Weiming-Hu/AnalogsEnsemble/raw/master/RAnalogs/releases/RAnEn_latest.tar.gz",  :
  installation of package ‘/var/folders/z2/qq0ntf292kj8hy14ckfrmlp80000gp/T//RtmpjdSCrP/downloaded_packages/RAnEn_latest.tar.gz’ had non-zero exit status
Weiming-Hu commented 4 years ago

Please see this related issue.

I got it working by updating Rcpp. I ran the following line:

install.packages(c("Rcpp", "RcppParallel", "digest"), type = "source")

Although I don't think RcppParallel and digest actually needs to be upgraded since I'm not depending on those packages, I did it anyway.

Weiming-Hu commented 4 years ago

Since it worked with clang++, let's try with brew installed gcc which will enable multi-threading.

Apparently it did not work out of the box because of the missing /usr/include.

I need to do two things to make it work with gcc.

  1. Reinstall Rcpp with the same gcc compiler. This can be done by adding an Makevars under ~/.R like what I did here.
  2. Update Xcode and license. Here is a post to solve the problem. I only run the xcode-select command and confirmed my license. Things started to work again.
Weiming-Hu commented 4 years ago

Alternatively, you can see this post to enable multi-threading. It is from the installation guide of data.table.