Apologies in advance if this is duplicative, but I can’t seem to find another post here with the exact same problem, though it seems others are running into similar things.
I recently upgraded to R 4.0.2 and reinstalled rstan, rstanarm, and cmdstanr from their CRAN binaries. But running
example(stan_model, run.dontrun=T) after loading rstan gives me
Compilation argument: /Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB file745c506a04e8.cpp 2> file745c506a04e8.cpp.err.txt clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -Wno-unknown-pragmas -I/usr/local/include -include /Library/Frameworks/R.framework/Versions/4.0/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp -I '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/StanHeaders/include' -I '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include' -fPIC -O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function -fPIC -c file745c506a04e8.cpp -o file745c506a04e8.o file745c506a04e8.cpp:7:10: fatal error: 'Rcpp.h' file not found #include <Rcpp.h> ^~~~~~~~ 1 error generated. make: *** [file745c506a04e8.o] Error 1
And when I try to run a model with cmdstanr, I get
Error in processx::run(command = make_cmd(), args = c(cpp_options_to_compile_flags(cpp_options), : System command 'make' failed, exit status: 2, stderr: E> /Users/cmccartan/.cmdstanr/cmdstan-2.22.1/src/cmdstan/main.cpp:1:10: fatal error: 'stan/services/error_codes.hpp' file not found E> #include <stan/services/error_codes.hpp> E> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ E> 1 error generated. E> make: *** [/Users/cmccartan/.cmdstanr/cmdstan-2.22.1/src/cmdstan/main.o] Error 1
I’m able to use Rcpp+Eigen in another package I’m developing, so I don’t think the problem is with them.
PKG_CPPFLAGS = -Wno-unknown-pragmas FC = /usr/local/bin/gfortran FLIBS = -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm CXX14FLAGS=-O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function -fPIC
and I have nothing except API keys in my
.Renviron. I’ve upgraded the Mac command line tools recently as well.
Other threads suggested I install StanHeaders by downloading a zip, deleting zzz.R, and running R CMD Build, but that complained about a missing