stan-dev / stan-dev/rstan

rstan installation failed on Linux

Open
#744 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
1.1k
Forks
266
Avg merge
2h 56m
Merged PRs (30d)
1

Description

Summary:

The rstan package installation as detailed on https://github.com/stan-dev/rstan/wiki/Installing-RStan-on-Linux failed.

Description:

I am unable to install rstan from source on Linux RedHat.

Reproducible Steps:

Following instructions on the getting started page (url above), I enter the following into the console:

dotR <- file.path(Sys.getenv("HOME"), ".R")
if (!file.exists(dotR)) dir.create(dotR)
M <- file.path(dotR, "Makevars")
if (!file.exists(M)) file.create(M)
cat("\nCXX14FLAGS=-O3 -march=native -mtune=native -fPIC",
    "CXX14=g++", # or clang++ but you may need a version postfix
    file = M, sep = "\n", append = TRUE) `

. Then, following the same instructions, I enter:

remove.packages("rstan")
remove.packages("StanHeaders")
if (file.exists(".RData")) file.remove(".RData")`

. Then I restart the R session, opting to save the workspace image (C++ toolchain configuration), and enter the following into the console:

Sys.setenv(MAKEFLAGS = "-j4") # four cores used
install.packages("rstan", type = "source")`

. I have also tried

remotes::install_github("stan-dev/rstan", ref = "develop", subdir = "rstan/rstan", build_opts = "")

. But neither option was successful.
If you have a reproducible example, please include it.

Current Output:
[Workspace loaded from ~/.RData]
> Sys.setenv(MAKEFLAGS = "-j4") # four cores used
> if (!require("remotes")) {
+     install.packages("remotes")
+ }
Loading required package: remotes
> 
> remotes::install_github("stan-dev/rstantools")
Skipping install of 'rstantools' from a github remote, the SHA1 (02d84b4c) has not changed since last install.
  Use `force = TRUE` to force installation
> remotes::install_github("stan-dev/rstan", ref = "develop", subdir = "rstan/rstan", build_opts = "")
Downloading GitHub repo stan-dev/rstan@develop
These packages have more recent versions available.
Which would you like to update?

 1: All                                   
 2: CRAN packages only                    
 3: None                                  
 4: StanHeaders (2.19.0  -> 2.19.2) [CRAN]
 5: pkgbuild    (1.0.5   -> 1.0.6 ) [CRAN]
 6: scales      (1.0.0   -> 1.1.0 ) [CRAN]
 7: callr       (3.3.1   -> 3.4.2 ) [CRAN]
 8: cli         (1.1.0   -> 2.0.1 ) [CRAN]
 9: farver      (1.1.0   -> 2.0.3 ) [CRAN]
10: fansi       (0.4.0   -> 0.4.1 ) [CRAN]
11: pillar      (1.4.2   -> 1.4.3 ) [CRAN]
12: pkgconfig   (2.0.2   -> 2.0.3 ) [CRAN]
13: vctrs       (0.2.0   -> 0.2.2 ) [CRAN]
14: ellipsis    (0.2.0.1 -> 0.3.0 ) [CRAN]
15: processx    (3.4.1   -> 3.4.2 ) [CRAN]
16: ps          (1.3.0   -> 1.3.2 ) [CRAN]

Enter one or more numbers, or an empty line to skip updates:

✔  checking for file ‘/tmp/Rtmp98EAkX/remotes8b4a49866f1d/stan-dev-rstan-fef82e9/rstan/rstan/DESCRIPTION’ ...
─  preparing ‘rstan’: (2.1s)
✔  checking DESCRIPTION meta-information ...
─  cleaning src
─  installing the package to build vignettes (360ms)
         -----------------------------------
─  installing *source* package ‘rstan’ ...
   ** libs
   g++  -I"/usr/include/R" -DNDEBUG -I"../inst/include" -I"../inst/include/boost_not_in_BH" -I"." -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -D_REENTRANT -DSTAN_THREADS  -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/Rcpp/include" -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/RcppEigen/include" -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/BH/include" -I"/usr/lib64/R/library/StanHeaders/include" -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/RcppParallel/include" -I/usr/local/include     -O3 -march=native -mtune=native -fPIC -c Module.cpp -o Module.o
   g++  -I"/usr/include/R" -DNDEBUG -I"../inst/include" -I"../inst/include/boost_not_in_BH" -I"." -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -D_REENTRANT -DSTAN_THREADS  -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/Rcpp/include" -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/RcppEigen/include" -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/BH/include" -I"/usr/lib64/R/library/StanHeaders/include" -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/RcppParallel/include" -I/usr/local/include     -O3 -march=native -mtune=native -fPIC -c chains.cpp -o chains.o
   g++  -I"/usr/include/R" -DNDEBUG -I"../inst/include" -I"../inst/include/boost_not_in_BH" -I"." -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -D_REENTRANT -DSTAN_THREADS  -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/Rcpp/include" -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/RcppEigen/include" -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/BH/include" -I"/usr/lib64/R/library/StanHeaders/include" -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/RcppParallel/include" -I/usr/local/include     -O3 -march=native -mtune=native -fPIC -c init.cpp -o init.o
   g++  -I"/usr/include/R" -DNDEBUG -I"../inst/include" -I"../inst/include/boost_not_in_BH" -I"." -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -D_REENTRANT -DSTAN_THREADS  -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/Rcpp/include" -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/RcppEigen/include" -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/BH/include" -I"/usr/lib64/R/library/StanHeaders/include" -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/RcppParallel/include" -I/usr/local/include     -O3 -march=native -mtune=native -fPIC -c misc.cpp -o misc.o
   g++  -I"/usr/include/R" -DNDEBUG -I"../inst/include" -I"../inst/include/boost_not_in_BH" -I"." -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -D_REENTRANT -DSTAN_THREADS  -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/Rcpp/include" -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/RcppEigen/include" -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/BH/include" -I"/usr/lib64/R/library/StanHeaders/include" -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/RcppParallel/include" -I/usr/local/include     -O3 -march=native -mtune=native -fPIC -c pointer-tools.cpp -o pointer-tools.o
   In file included from /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/autodiffstackstorage.hpp:4,
                    from /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core.hpp:4,
                    from ./stan/model/model_base.hpp:5,
                    from Module.cpp:2:
   /usr/lib64/R/library/StanHeaders/include/stan/math/memory/stack_alloc.hpp: In destructor ‘stan::math::stack_alloc::~stack_alloc()’:
   /usr/lib64/R/library/StanHeaders/include/stan/math/memory/stack_alloc.hpp:145: error: expected initializer before ‘:’ token
   /usr/lib64/R/library/StanHeaders/include/stan/math/memory/stack_alloc.hpp:148: error: expected primary-expression before ‘}’ token
   /usr/lib64/R/library/StanHeaders/include/stan/math/memory/stack_alloc.hpp:148: error: expected ‘;’ before ‘}’ token
   /usr/lib64/R/library/StanHeaders/include/stan/math/memory/stack_alloc.hpp:148: error: expected primary-expression before ‘}’ token
   /usr/lib64/R/library/StanHeaders/include/stan/math/memory/stack_alloc.hpp:148: error: expected ‘)’ before ‘}’ token
   /usr/lib64/R/library/StanHeaders/include/stan/math/memory/stack_alloc.hpp:148: error: expected primary-expression before ‘}’ token
   /usr/lib64/R/library/StanHeaders/include/stan/math/memory/stack_alloc.hpp:148: error: expected ‘;’ before ‘}’ token
   In file included from /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core.hpp:4,
                    from ./stan/model/model_base.hpp:5,
                    from Module.cpp:2:
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/autodiffstackstorage.hpp: At global scope:
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/autodiffstackstorage.hpp:47: warning: defaulted and deleted functions only available with -std=c++0x or -std=gnu++0x
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/autodiffstackstorage.hpp:60: warning: defaulted and deleted functions only available with -std=c++0x or -std=gnu++0x
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/autodiffstackstorage.hpp:61: warning: defaulted and deleted functions only available with -std=c++0x or -std=gnu++0x
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/autodiffstackstorage.hpp:62: warning: defaulted and deleted functions only available with -std=c++0x or -std=gnu++0x
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/autodiffstackstorage.hpp: In static member function ‘static stan::math::AutodiffStackSingleton<ChainableT, ChainableAllocT>::AutodiffStackStorage& stan::math::AutodiffStackSingleton<ChainableT, ChainableAllocT>::instance()’:
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/autodiffstackstorage.hpp:66: error: ‘thread_local’ was not declared in this scope
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/autodiffstackstorage.hpp:66: error: expected ‘;’ before ‘static’
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/autodiffstackstorage.hpp:68: error: ‘instance_’ was not declared in this scope
   g++  -I"/usr/include/R" -DNDEBUG -I"../inst/include" -I"../inst/include/boost_not_in_BH" -I"." -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -D_REENTRANT -DSTAN_THREADS  -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/Rcpp/include" -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/RcppEigen/include" -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/BH/include" -I"/usr/lib64/R/library/StanHeaders/include" -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/RcppParallel/include" -I/usr/local/include     -O3 -march=native -mtune=native -fPIC -c sparse_extractors.cpp -o sparse_extractors.o
   In file included from chains.cpp:19:
   /usr/lib64/R/library/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp: In function ‘typename boost::math::tools::promote_args<T, float, float, float, float, float>::type stan::math::mean(const std::vector<T, std::allocator<_CharT> >&)’:
   /usr/lib64/R/library/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp:24: error: an array reference cannot appear in a constant-expression
   /usr/lib64/R/library/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp:24: error: ‘&’ cannot appear in a constant-expression
   /usr/lib64/R/library/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp:24: error: ‘.’ cannot appear in a constant-expression
   /usr/lib64/R/library/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp:24: error: a function call cannot appear in a constant-expression
   /usr/lib64/R/library/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp:24: error: a function call cannot appear in a constant-expression
   /usr/lib64/R/library/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp:24: error: template argument 3 is invalid
   /usr/lib64/R/library/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp:24: error: template argument 4 is invalid
   /usr/lib64/R/library/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp:24: error: template argument 6 is invalid
   /usr/lib64/R/library/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp:24: error: template argument 1 is invalid
   /usr/lib64/R/library/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp:25: error: ‘m’ was not declared in this scope
   In file included from /usr/lib64/R/library/StanHeaders/include/stan/math/prim/mat/fun/sum.hpp:5,
                    from chains.cpp:20:
   /usr/lib64/R/library/StanHeaders/include/stan/math/prim/arr/fun/sum.hpp: In function ‘T stan::math::sum(const std::vector<T, std::allocator<_CharT> >&)’:
   /usr/lib64/R/library/StanHeaders/include/stan/math/prim/arr/fun/sum.hpp:20: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x
   In file included from /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/build_vari_array.hpp:5,
                    from /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core.hpp:5,
                    from ./stan/model/model_base.hpp:5,
                    from Module.cpp:2:
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/var.hpp: In member function ‘bool stan::math::var::is_uninitialized()’:
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/var.hpp:56: error: ‘nullptr’ was not declared in this scope
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/var.hpp: In function ‘std::ostream& stan::math::operator<<(std::ostream&, const stan::math::var&)’:
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/var.hpp:473: error: ‘nullptr’ was not declared in this scope
   g++  -I"/usr/include/R" -DNDEBUG -I"../inst/include" -I"../inst/include/boost_not_in_BH" -I"." -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -D_REENTRANT -DSTAN_THREADS  -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/Rcpp/include" -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/RcppEigen/include" -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/BH/include" -I"/usr/lib64/R/library/StanHeaders/include" -I"/home/cfpb/gardnerj/R/x86_64-redhat-linux-gnu-library/3.5/RcppParallel/include" -I/usr/local/include     -O3 -march=native -mtune=native -fPIC -c stan_fit_base.cpp -o stan_fit_base.o
   In file included from /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core.hpp:43,
                    from ./stan/model/model_base.hpp:5,
                    from Module.cpp:2:
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/recover_memory.hpp: In function ‘void stan::math::recover_memory()’:
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/recover_memory.hpp:25: error: expected initializer before ‘:’ token
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/recover_memory.hpp:28: error: could not convert ‘stan::math::AutodiffStackSingleton<ChainableT, ChainableAllocT>::instance [with ChainableT = stan::math::vari, ChainableAllocT = stan::math::chainable_alloc]()->stan::math::AutodiffStackSingleton<stan::math::vari, stan::math::chainable_alloc>::AutodiffStackStorage::var_alloc_stack_.std::vector<_Tp, _Alloc>::clear [with _Tp = stan::math::chainable_alloc*, _Alloc = std::allocator<stan::math::chainable_alloc*>]()’ to ‘bool’
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/recover_memory.hpp:29: error: expected ‘)’ before ‘;’ token
   In file included from /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core.hpp:45,
                    from ./stan/model/model_base.hpp:5,
                    from Module.cpp:2:
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp: In function ‘void stan::math::set_zero_all_adjoints()’:
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:15: error: expected initializer before ‘:’ token
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:17: error: expected primary-expression before ‘for’
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:17: error: expected ‘;’ before ‘for’
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:17: error: expected primary-expression before ‘for’
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:17: error: expected ‘)’ before ‘for’
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:17: error: expected initializer before ‘:’ token
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:19: error: expected primary-expression before ‘}’ token
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:19: error: expected ‘;’ before ‘}’ token
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:19: error: expected primary-expression before ‘}’ token
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:19: error: expected ‘)’ before ‘}’ token
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:19: error: expected primary-expression before ‘}’ token
   /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:19: error: expected ‘;’ before ‘}’ token
   Module.cpp: In function ‘Rcpp::List get_dims(stan::model::model_base*)’:
   Module.cpp:30: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x
   Module.cpp:30: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x
   make: *** [Module.o] Error 1
   make: *** Waiting for unfinished jobs....
   make: *** [chains.o] Error 1
   ERROR: compilation failed for package ‘rstan’
─  removing ‘/tmp/RtmpU0IXcu/Rinst8dd8602321d/rstan’
         -----------------------------------
   ERROR: package installation failed
Error: Failed to install 'rstan' from GitHub:
  System command error, exit status: 1, stdout + stderr (last 10 lines):
E> Module.cpp: In function ‘Rcpp::List get_dims(stan::model::model_base*)’:
E> Module.cpp:30: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x
E> Module.cpp:30: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x
E> make: *** [Module.o] Error 1
E> make: *** Waiting for unfinished jobs....
E> make: *** [chains.o] Error 1
E> ERROR: compilation failed for package ‘rstan’
E> * removing ‘/tmp/RtmpU0IXcu/Rinst8dd8602321d/rstan’
E>       -----------------------------------
E> ERROR: package installation failed
Expected Output:

NA

RStan Version:

‘2.17.3’

R Version:

R version 3.5.2 (2018-12-20)

Operating System:

x86_64-redhat-linux-gnu (64-bit)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Linux installation wiki page and reproduce the failure using the R commands shown in the issue, including the rstan GitHub installation path. Inspect the reported g++ errors in StanHeaders and the RStan source build output; done means the installation succeeds on the reported Linux RedHat setup or the failure is documented with a verified resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux, r
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.