stan-dev / rstan

RStan, the R interface to Stan
https://mc-stan.org
1.04k stars 265 forks source link

Error Installing Packages dependent on StanHeaders #942

Open ynraza opened 3 years ago

ynraza commented 3 years ago

Hi there, I'm running into errors when compiling packages in R dependent on StanHeaders. I've pasted a small section of the error below.

/Library/Frameworks/R.framework/Versions/4.0/Resources/library/StanHeaders/include/stan/math/prim/scal/meta/index_type.hpp:28:27: error: no template named 'enable_if_t' in namespace 'std'; did you mean 'enable_if'? struct index_type<T, std::enable_if_t<std::is_pointer::value>> {


                          enable_if
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:538:63: note: 'enable_if' declared here
template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {};
                                                              ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
19 warnings and 20 errors generated.
make: *** [stan_files/bb_with_re.o] Error 1
19 warnings and 20 errors generated.
make: *** [stan_files/bb_fixed_conc.o] Error 1
rm stan_files/bb_fixed_conc.cc stan_files/is_het.cc stan_files/bb_w_replicates.cc stan_files/bb_with_re.cc stan_files/bb.cc

Operating System:
macOS Catalina Version 10.15.6

> system("R --version")
R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"

> packageVersion("rstan")
[1] ‘2.21.3’

> packageVersion("StanHeaders")
[1] ‘2.21.0.7’

> system("clang++ --version")
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

> readLines("~/.R/Makevars")
[1] "CXX14FLAGS += -O3 -mtune=native -arch x86_64 -ftemplate-depth-256"

Any help would be greatly appreciated. Thanks!
andrjohns commented 3 years ago

These errors indicate that R isn't compiling in c++14 mode, you need to configure the package (if it's yours) to call the CXX14 compiler when installing