stan-dev / rstan

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

Unable to install rstan on macOS Sonoma 14.2.1 #1121

Closed alexwarstadt closed 3 months ago

alexwarstadt commented 3 months ago

Summary:

I'm trying to install rstan from source, but compilation fails.

Reproducible Steps:

I am following instructions for macOS here. I'm not very experienced with R, but as far as I can tell, all steps are successful until:

https://github.com/stan-dev/rstan/wiki/Installing-RStan-from-Source#mac

Current Output:

The output is quite long. Here is the final error message, but the full output is attached at the bottom of the issue:

error: no template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?
        struct hash_base : std::unary_function<T, std::size_t> {};
                           ~~~~~^~~~~~~~~~~~~~
                                __unary_function
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/unary_function.h:46:1: note: '__unary_function' declared here
using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;
^
21 warnings and 1 error generated.
make: *** [chains.o] Error 1
ERROR: compilation failed for package ‘rstan’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan’
Warning in install.packages :
  installation of package ‘rstan’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/7h/6cgx7s1x6lxd9ckwpv2zfsjc0000gn/T/RtmpoRC7kU/downloaded_packages’

Session info:

R version 4.2.2 (2022-10-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS 14.2.1

Complete output

rstan_output.log

alexwarstadt commented 3 months ago

I resolved this issue by updating to the latest release of R (version 4.3.3).