I’ve been working through all the excellent resources on this forum but still haven’t had any luck getting things working yet. I’ve checked just configuring the rstan headers and that doesn’t work either:
install.packages(c("StanHeaders", "rstan"), type = "source")
This gives me back:
trying URL 'https://cran.rstudio.com/src/contrib/StanHeaders_2.26.27.tar.gz'
Content type 'application/x-gzip' length 2307044 bytes (2.2 MB)
==================================================
downloaded 2.2 MB
trying URL 'https://cran.rstudio.com/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 ‘StanHeaders’ ...
** package ‘StanHeaders’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -DNO_FPRINTF_OUTPUT -I"../inst/include" -I"sundials" -include stan_sundials_printf_override.hpp -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -DBOOST_NO_AUTO_PTR -D_REENTRANT -DSTAN_THREADS -DSTRICT_R_HEADERS -DUSE_PTHREAD -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/RcppEigen/include' -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/RcppParallel/include' -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c cvodes/cvodes_spils.c -o cvodes/cvodes_spils.o
In file included from cvodes/cvodes_spils.c:19:
In file included from ../inst/include/cvodes/cvodes_ls.h:21:
../inst/include/sundials/sundials_direct.h:22:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^~~~~~~~~
1 error generated.
make: *** [/Library/Frameworks/R.framework/Resources/etc/Makeconf:169: cvodes/cvodes_spils.o] Error 1
ERROR: compilation failed for package ‘StanHeaders’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/StanHeaders’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/StanHeaders’
Warning in install.packages :
installation of package ‘StanHeaders’ had non-zero exit status
* installing *source* package ‘rstan’ ...
** package ‘rstan’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
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.2-arm64/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/RcppEigen/include' -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/StanHeaders/include' -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/RcppParallel/include' -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c init.cpp -o init.o
clang-14: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
In file included from init.cpp:25:
In file included from /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/RcppEigen/include/RcppEigen.h:25:
/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/RcppEigen/include/RcppEigenForward.h:25:10: fatal error: 'iterator' file not found
#include <iterator>
^~~~~~~~~~
1 error generated.
make: *** [/Library/Frameworks/R.framework/Resources/etc/Makeconf:176: init.o] Error 1
ERROR: compilation failed for package ‘rstan’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/rstan’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.2-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/pk/v31bk0rx0mvfl7r242p2hcqh0000gn/T/Rtmp1mgMHK/downloaded_packages’
Seems like R can’t find headers but I have XCode and XCode commandline tools both installed as well.
clang -v
Apple clang version 15.0.0 (clang-1500.0.38.1)
Target: arm64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Operating System: OSX 13.5
Interface Version: RStudio 2023.06.1
Compiler/Toolkit: R version 4.2.3 (2023-03-15)
A few other calls I’ve seen other folks find helpful
Sys.getenv("PATH")
is
"/Users/joshuanoble/opt/anaconda3/bin:/Users/joshuanoble/opt/anaconda3/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/joshuanoble/Applications/quarto/bin:/Library/TeX/texbin:/usr/texbin:/Applications/RStudio.app/Contents/Resources/app/quarto/bin:/Applications/RStudio.app/Contents/Resources/app/bin/postback:/Applications/RStudio.app/Contents/Resources/app/bin/postback"
Sys.getenv("LDLIBS")
[1] ""
Neither ~/.Renviron
nor ~/.R/Makevars
nor ~/.R/Rprofile
exist.
Happy to put what happens when I run example(stan_model, package = "rstan", run.dontrun = TRUE, verbose = TRUE)
as well. Thanks so much for any tips