I’m having problems similar to the ones windows folks were having compiling stan models after upgrading to R 4.0.2. Unfortunately none of their solutions worked for me.
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from :1:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/Core:82:
In file included from /Library/Developer/CommandLineTools/usr/bin/…/include/c++/v1/new:90:
In file included from /Library/Developer/CommandLineTools/usr/bin/…/include/c++/v1/exception:81:
In file included from /Library/Developer/CommandLineTools/usr/bin/…/include/c++/v1/cstdlib:85:
In file included from /Library/Developer/CommandLineTools/usr/bin/…/include/c++/v1/stdlib.h:93:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:66:
In file included from /Library/Developer
In addition: Warning messages:
1: In system2(CXX, args = ARGS) : error in running command
2: In file.remove(c(unprocessed, processed)) :
cannot remove file ‘/var/folders/bj/v8pg71qd5wdfm8nl9kf5qjqm0000gn/T//RtmpRRpWKB/file30c5a38b13b.stan’, reason ‘No such file or directory’
There have been quite a few of these errors reported over the past month or so and I was hoping to be able to solve it based on the previous answers, but I couldn’t get any of them to work. Thanks in advance for the help!
This should be fixed on CRAN, although you might have to install rstan from source until binaries are rebuilt. But I don’t know why the -arch x86_64 -ftemplate-depth-256 stuff has to be part of the compiler invocation. If that stuff really is needed, it should be part of CXX1*FLAGS.
When I try installing rstan from source I get the following errors at many points in the attempted installation process to the point where it says there are too many errors and it is aborting the installation ( fatal error: too many errors emitted, stopping now [-ferror-limit=])
Error type 1:
/usr/local/include/stdint.h:2:10: error: #include nested too deeply #include <stddef.h>
Error type 2:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/resource.h:197:2: error: unknown type name ‘uint64_t’
uint64_t ri_user_time;
^
Also I have no idea about the things the makevars file. I can try removing them if you think that would help though.
My guess is that this is caused by having something in your ~/.Rprofile or ~/.Renviron files that changes the PATH environmental variable. If you comment that out, it should work with the clang++ in Xcode.
I think it’s probably worth trying emptying out Makevars and starting fresh with just that. (I’m not sure if -arch x86_64 is actually necessary but it shouldn’t hurt.)
I think to check the contents of the PATH environment variable from R you can do Sys.getenv("PATH")
@echellwig Sorry we don’t have any good ideas here. Since both @bgoodri and I are out of ideas maybe it’s worth trying our other R interface CmdStanR instead of RStan and seeing that works?