Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error installing rstan on macOS Ventura 13.4 with arm64 architecture: Need assistance with C++ compilation #1077

Closed
truenomad opened this issue Jun 19, 2023 · 7 comments

Comments

@truenomad
Copy link

truenomad commented Jun 19, 2023

Summary:

I have been attempting to install rstan on macOS Ventura 13.4 with arm64 architecture, following the guide provided in the official rstan GitHub repository (https://github.com/stan-dev/rstan/wiki/Installing-RStan-from-Source#mac). My system has Xcode and command line tools version 14.3.1, as well as Clang version 14.0.3.

I suspect that the error is related to the C++ code that rstan attempts to compile, but I am uncertain about the appropriate steps to take from here. I have tried various solutions suggested in Stack Overflow threads without any success. Some of the threads I have explored include:

https://apple.stackexchange.com/questions/458062/unable-to-find-include-file-on-newly-updated-macosc-c

https://stackoverflow.com/questions/75921280/updating-to-macos-13-3-broke-compiling-cpp

Reproducible Steps:

Here is the code I have used for installation:

install.packages("rstan", type = "source”)

Unfortunately, the package does not download successfully and produces the following error:

trying URL 'http://cran.us.r-project.org/src/contrib/rstan_2.21.8.tar.gz'
Content type 'application/x-gzip' length 1203455 bytes (1.1 MB)
==================================================
downloaded 1.1 MB

* installing *source* package ‘rstan’ ...
** package ‘rstan’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C++ compiler: ‘Apple clang version 14.0.3 (clang-1403.0.22.14.1)’
using C++14
using SDK: ‘’
clang++ -arch arm64 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"../inst/include" -I"../inst/include/boost_not_in_BH" -I"." -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -DBOOST_NO_AUTO_PTR -D_REENTRANT -DSTAN_THREADS   -I'/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/RcppEigen/include' -I'/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/StanHeaders/include' -I'/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/RcppParallel/include' -I/opt/R/arm64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -O3 -mtune=native -arch arm64 -ftemplate-depth-256 -c Module.cpp -o Module.o
In file included from Module.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp.h:27:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/RcppCommon.h:30:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp/r/headers.h:62:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:100:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:310:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:421:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/invoke.h:15:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/apply_cv.h:16:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/remove_reference.h:13:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cstddef:50:9: error: no member named 'nullptr_t' in the global namespace
using ::nullptr_t;
      ~~^
In file included from Module.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp.h:27:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/RcppCommon.h:30:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp/r/headers.h:62:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:100:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:310:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:452:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_compound.h:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_fundamental.h:14:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_null_pointer.h:24:49: error: use of undeclared identifier 'nullptr_t'; did you mean 'nullptr'?
template <>          struct __is_nullptr_t_impl<nullptr_t> : public true_type {};
                                                ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_null_pointer.h:24:49: error: template argument for template type parameter must be a type
template <>          struct __is_nullptr_t_impl<nullptr_t> : public true_type {};
                                                ^~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_null_pointer.h:23:17: note: template parameter is declared here
template <class _Tp> struct __is_nullptr_t_impl       : public false_type {};
                ^
In file included from Module.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp.h:27:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/RcppCommon.h:30:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp/r/headers.h:62:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:153:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/unordered_map:517:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/is_permutation.h:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/iterator_operations.h:15:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/advance.h:19:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__utility/unreachable.h:13:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cstdlib:123:9: error: target of using declaration conflicts with declaration already in scope
using ::abs _LIBCPP_USING_IF_EXISTS;
        ^
/usr/local/include/stdlib.h:132:6: note: target of using declaration
int      abs(int) __pure2;
         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:339:1: note: conflicting declaration
using ::abs _LIBCPP_USING_IF_EXISTS;
^
In file included from Module.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp.h:27:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/RcppCommon.h:30:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp/r/headers.h:62:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:153:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/unordered_map:523:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__hash_table:25:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:848:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/allocator.h:18:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/new:94:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/exception:149:45: error: field has incomplete type 'std::exception_ptr'
    _LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
                                            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/exception:144:24: note: definition of 'std::exception_ptr' is not complete until the closing '}'
class _LIBCPP_TYPE_VIS exception_ptr
                       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/exception:149:5: error: '__abi_tag__' attribute only applies to structs, variables, functions, and namespaces
    _LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:689:37: note: expanded from macro '_LIBCPP_INLINE_VISIBILITY'
#  define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI
                                    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:673:26: note: expanded from macro '_LIBCPP_HIDE_FROM_ABI'
          __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_VERSIONED_IDENTIFIER))))
                         ^
In file included from Module.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp.h:27:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/RcppCommon.h:30:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp/r/headers.h:62:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:153:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/unordered_map:523:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__hash_table:25:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:848:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/allocator.h:18:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/new:94:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/exception:149:55: error: expected ';' at end of declaration list
    _LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
                                                      ^
In file included from Module.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp.h:27:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/RcppCommon.h:30:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp/r/headers.h:62:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:153:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/unordered_map:523:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__hash_table:25:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:860:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:28:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:173:3: error: non-static data member cannot be constexpr; did you intend to make it const?
  _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:728:31: note: expanded from macro '_LIBCPP_CONSTEXPR'
#    define _LIBCPP_CONSTEXPR constexpr
                              ^
In file included from Module.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp.h:27:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/RcppCommon.h:30:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp/r/headers.h:62:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:153:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/unordered_map:523:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__hash_table:25:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:860:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:28:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:173:32: error: member 'nullptr_t' declared as a template
  _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
                               ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:173:42: error: expected ';' at end of declaration list
  _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
                                         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:262:25: error: unknown type name 'nullptr_t'
  unique_ptr& operator=(nullptr_t) _NOEXCEPT {
                        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:395:3: error: non-static data member cannot be constexpr; did you intend to make it const?
  _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:728:31: note: expanded from macro '_LIBCPP_CONSTEXPR'
#    define _LIBCPP_CONSTEXPR constexpr
                              ^
In file included from Module.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp.h:27:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/RcppCommon.h:30:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp/r/headers.h:62:
In file included from /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:153:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/unordered_map:523:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__hash_table:25:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:860:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:28:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:395:32: error: member 'nullptr_t' declared as a template
  _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
                               ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:395:42: error: expected ';' at end of declaration list
  _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
                                         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:484:25: error: unknown type name 'nullptr_t'
  unique_ptr& operator=(nullptr_t) _NOEXCEPT {
                        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:533:14: error: unknown type name 'nullptr_t'
  void reset(nullptr_t = nullptr) _NOEXCEPT {
             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:533:24: error: cannot initialize a parameter of type 'int' with an rvalue of type 'std::nullptr_t'
  void reset(nullptr_t = nullptr) _NOEXCEPT {
                       ^ ~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:533:24: note: passing argument to parameter here
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:594:45: error: unknown type name 'nullptr_t'
operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT
                                            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:602:12: error: unknown type name 'nullptr_t'
operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT
           ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Module.o] Error 1
ERROR: compilation failed for package ‘rstan’
* removing ‘/Library/Frameworks/R.framework/Versions/4.3-arm64/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/tj/gxsjjg6x3z3g43qcm49tmfmh0000gn/T/Rtmp38B6Sd/downloaded_packages’

RStan Version: 2.21.8

R Version: 4.3.1

The version of R you are running (e.g., from R.version.string)

Operating System: M2 Mac with macOS Ventura 13.4 with arm64

R session Info:

R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.4

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/London
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.3.1 tools_4.3.1
@bob-carpenter
Copy link

bob-carpenter commented Jun 20, 2023

If you only need to run Stan models and don't need to build a binary package or access log densities and gradients, you might want to try cmdstanr. It's easier to install and more up-to-date with Stan. RStan is being updated and the plan is to bring the CRAN version up to date in the immediate future, but it's a painstaking process with all the dependent packages and CRAN rules.

@truenomad
Copy link
Author

Hi @bob-carpenter
Thanks for the response. I have already tried cmdstanr and the same issue arises when trying to compile models. Not sure what is going.

install_cmdstan(cores = 10)
`The C++ toolchain required for CmdStan is setup properly!

  • Latest CmdStan release is v2.32.2
  • Installing CmdStan v2.32.2 in /Users/mohamedyusuf/.cmdstan/cmdstan-2.32.2
  • Downloading cmdstan-2.32.2.tar.gz from GitHub...
    Warning message:
    An installation already exists at /Users/mohamedyusuf/.cmdstan/cmdstan-2.32.2. Please remove or rename the installation folder or set overwrite=TRUE.`
file <- file.path(cmdstan_path(), "examples", "bernoulli", "bernoulli.stan")
mod <- cmdstan_model(file)
Compiling Stan program...
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:4:
In file included from src/cmdstan/arguments/arg_data.hpp:4:
In file included from src/cmdstan/arguments/categorical_argument.hpp:4:
In file included from src/cmdstan/arguments/argument.hpp:4:
In file included from stan/src/stan/callbacks/writer.hpp:4:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/lexical_cast.hpp:30:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/range/iterator_range_core.hpp:26:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/iterator/iterator_traits.hpp:10:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iterator:679:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__debug:15:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cstddef:50:9: error: no member named 'nullptr_t' in the global namespace
using ::nullptr_t;
      ~~^

In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:4:
In file included from src/cmdstan/arguments/arg_data.hpp:4:
In file included from src/cmdstan/arguments/categorical_argument.hpp:4:
In file included from src/cmdstan/arguments/argument.hpp:4:
In file included from stan/src/stan/callbacks/writer.hpp:4:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/lexical_cast.hpp:30:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/range/iterator_range_core.hpp:26:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/iterator/iterator_traits.hpp:10:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iterator:679:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__debug:16:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:452:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_compound.h:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_fundamental.h:14:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_null_pointer.h:24:49: error: use of undeclared identifier 'nullptr_t'; did you mean 'nullptr'?
template <>          struct __is_nullptr_t_impl<nullptr_t> : public true_type {};
                                                ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_null_pointer.h:24:49: error: template argument for template type parameter must be a type
temp
late <>          struct __is_nullptr_t_impl<nullptr_t> : public true_type {};
                                                ^~~~~~~~~

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_null_pointer.h:23:17: note: template parameter is declared here
template <class _Tp> struct __is_nullptr_t_impl       : public false_type {};
                ^

In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:4:
In file included from src/cmdstan/arguments/arg_data.hpp:4:
In file included from src/cmdstan/arguments/categorical_argument.hpp:4:
In file included from src/cmdstan/arguments/argument.hpp:4:
In file included from stan/src/stan/callbacks/writer.hpp:4:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/lexical_cast.hpp:30:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/range/iterator_range_core.hpp:26:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/iterator/iterator_traits.hpp:10:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iterator:684:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/common_iterator.h:22:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/variant:214:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/exception:149:45: error: field has incomplete type 'std::exception_ptr'
    _LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
                                            ^

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/exception:144:24: note: definition of 'std::exception_ptr' is not complete until the closing '}'
class _LIBCPP_TYPE_VIS exception_ptr
                       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/exception:149:5: error: '__abi_tag__' attribute only applies to structs, variables, functions, and namespaces
    _LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:689:37: note: expanded from macro '_LIBCPP_INLINE_VISIBILITY'
#  define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI
                                    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:673:26: note: expanded from macro '_LIBCPP_HIDE_FROM_ABI'
          __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_VERSIONED_IDENTIFIER))))
                         ^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:4:
In file included from src/cmdstan/arguments/arg_data.hpp:4:
In file included from src/cmdstan/arguments/categorical_argument.hpp:4:
In file included from src/cmdstan/arguments/argument.hpp:4:
In file included from stan/src/stan/callbacks/writer.hpp:4:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/lexical_cast.hpp:30:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/range/iterator_range_core.hpp:26:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/iterator/iterator_traits.hpp:10:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iterator:684:
In file included from /Applications/Xcode.app/Contents/Developer/
Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/common_iterator.h:22:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/variant:214:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/exception:149:55: error: expected ';' at end of declaration list
    _LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
                                                      ^

In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:4:
In file included from src/cmdstan/arguments/arg_data.hpp:4:
In file included from src/cmdstan/arguments/categorical_argument.hpp:4:
In file included from src/cmdstan/arguments/argument.hpp:4:
In file included from stan/src/stan/callbacks/writer.hpp:4:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/lexical_cast.hpp:30:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/range/iterator_range_core.hpp:38:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/range/functions.hpp:20:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/range/size.hpp:21:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/range/size_type.hpp:20:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/range/concepts.hpp:20:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/iterator/iterator_concepts.hpp:26:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:1712:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:860:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:28:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:173:3: error: non-static data member cannot be constexpr; did you intend to make it const?
  _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:728:31: note: expanded from macro '_LIBCPP_CONSTEXPR'
#    define _LIBCPP_CONSTEXPR constexpr
           
                   ^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:4:
In file included from src/cmdstan/arguments/arg_data.hpp:4:
In file included from src/cmdstan/arguments/categorical_argument.hpp:4:
In file included from src/cmdstan/arguments/argument.hpp:4:
In file included from stan/src/stan/callbacks/writer.hpp:4:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/lexical_cast.hpp:30:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/range/iterator_range_core.hpp:38:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/range/functions.hpp:20:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/range/size.hpp:21:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/range/size_type.hpp:20:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/range/concepts.hpp:20:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/iterator/iterator_concepts.hpp:26:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:1712:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:860:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:28:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:173:32: error: member 'nullptr_t' declared as a template
  _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
                               ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:173:42: error: expected ';' at end of declaration list
  _LIBCPP_CONSTEXPR u
nique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
                                         ^

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:262:25: error: unknown type name 'nullptr_t'
  unique_ptr& operator=(nullptr_t) _NOEXCEPT {
                        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:395:3: error: non-static data member cannot be constexpr; did you intend to make it const?
  _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:728:31: note: expanded from macro '_LIBCPP_CONSTEXPR'
#    define _LIBCPP_CONSTEXPR constexpr
                              ^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:4:
In file included from src/cmdstan/arguments/arg_data.hpp:4:
In file included from src/cmdstan/arguments/categorical_argument.hpp:4:
In file included from src/cmdstan/arguments/argument.hpp:4:
In file included from stan/src/stan/callbacks/writer.hpp:4:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/lexical_cast.hpp:30:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/range/iterator_range_core.hpp:38:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/range/functions.hpp:20:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/range/size.hpp:21:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/range/size_type.hpp:20:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/range/concepts.hpp:20:
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/iterator/iterator_concepts.hpp:26:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:1712:
In file included from /Applications
/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:860:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:28:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:395:32: error: member 'nullptr_t' declared as a template
  _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
                               ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:395:42: error: expected ';' at end of declaration list
  _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
                                         ^

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:484:25: error: unknown type name 'nullptr_t'
  unique_ptr& operator=(nullptr_t) _NOEXCEPT {
                        ^

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:533:14: error: unknown type name 'nullptr_t'
  void reset(nullptr_t = nullptr) _NOEXCEPT {
             ^

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:533:24: error: cannot initialize a parameter of type 'int' with an rvalue of type 'std::nullptr_t'
  void reset(nullptr_t = nullptr) _NOEXCEPT {
                       ^ ~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:533:24: note: passing argument to parameter here

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:594:45: error: unknown type name 'nullptr_t'
operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT
                                            ^

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:602:12: error: unknown type name 'nullptr_t'
operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT
           ^

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:610:45: error: unknown type name 'nullptr_t'
operator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT
                                            ^

fatal error: too many errors emitted, stopping now [-ferror-limit=]

20 errors generated.

make: *** [src/cmdstan/main_opencl.o] Error 1

Error: An error occured during compilation! See the message above for more information.
> 

@bob-carpenter
Copy link

I have no idea what's going on here, but it looks like a problem with OpenCL, which is what we use for GPU support. I'm pinging a few people who may know what's going on: @jgabry @SteveBronder @bgoodri.

@truenomad
Copy link
Author

I have no idea what's going on here, but it looks like a problem with OpenCL, which is what we use for GPU support. I'm pinging a few people who may know what's going on: @jgabry @SteveBronder @bgoodri.

Still struggling with this issue. Wonder if anyone mentioned here can help .

@jamesmbaazam
Copy link

jamesmbaazam commented Sep 11, 2023

HI @truenomad, I might have encountered a similar issue in the recent past, which was solved here stan-dev/cmdstanr#790. Try and follow the conversation and see if it helps.

@truenomad
Copy link
Author

HI @truenomad, I might have encountered a similar in the recent past, which was solved here stan-dev/cmdstanr#790. Try and follow the conversation and see if it helps.

This solves it !! Thank you so much.

@jamesmbaazam
Copy link

@truenomad Glad it helped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants