Running rstan with latest R (3.6.0) fails with Error in compileCode

This model compiles for me on Linux, but I’ll have to try it on Windows later.

1 Like

Thank you so much. Mine is Windows 10 and it is not working here.

Hello Ben (@bgoodri ), the code is still not working in my windows 10 laptop. Could you please help!

Hello!
I am using Mac OS now to know where am I lagging behind.
When I am using example(stan_model, package = “rstan”, run.dontrun = TRUE) in Mac OS, I am getting the error as follows (For windows, there was no error for this code):

Error in compileCode(f, code, language = language, verbose = verbose) :
** Compilation ERROR, function(s)/method(s) not created! During startup - Warning messages:**
1: Setting LC_CTYPE failed, using "C"
2: Setting LC_COLLATE failed, using "C"
3: Setting LC_TIME failed, using "C"
4: Setting LC_MESSAGES failed, using "C"
5: Setting LC_MONETARY failed, using "C"
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:4:
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:535:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
** #pragma clang diagnostic pop**
** ^**
In fi

On the other hand, when I am using my .stan code (“model_new.stan” attached above) in my Mac OS, the following error message I am getting.

Error in compileCode(f, code, language = language, verbose = verbose) :
** Compilation ERROR, function(s)/method(s) not created! During startup - Warning messages:

1: Setting LC_CTYPE failed, using "C"
2: Setting LC_COLLATE failed, using "C"
3: Setting LC_TIME failed, using "C"
4: Setting LC_MESSAGES failed, using "C"
5: Setting LC_MONETARY failed, using "C"
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:4:
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:535:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
** #pragma clang diagnostic pop**
** ^**
In fi
In addition: Warning message:
In system(cmd, intern = !verbose) :
** running command ‘/Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB file24fd5966e988.cpp 2> file24fd5966e988.cpp.err.txt’ had status 1**
Error in sink(type = “output”) : invalid connection


Please help!

I am getting the same error on Windows, so it seems to be some problem with how sundials is built by StanHeaders.

Thank you so much for your reply. Could you please let me know what should i do now?

Hope that I can fix it. Or use something other than Windows.

1 Like

thanks a lot. I am also using Mac OS for this. But over there even the example(stan_model, package = “rstan”, run.dontrun = TRUE) is giving an error. So, I got dishertened. Although I am not very habituated in Mac.

Macs should be fine with R 4.0

In Mac, I installed R 4.0 and the latest RTools only for doing this, as R was used seldom in that Mac. I installed “rstan” afresh too with dependencies = TRUE, but still getting the same error.
Do I need anything else to make it run in Mac?

Hello @bgoodri !
Has it been resolved? Have you found out any way out for Windows?
Moumita

This might have been fixed. Can you try it after installing the StanHeaders from CRAN?

Thanks for your reply. I downloaded “StanHeaders” from CRAN. But it is still giving the same error.

Hi - was there a solution to this under Windows? I’m having the same problem - example(stan_model…) samples fine, but the model I’m trying to run does not want to compile. It could be that I’ve made an error in the stan code, but I’m not seeing the error messages I’m used to seeing, just the ‘Error in compileCode…’ message.
Thanks

1 Like