I know people have been seeing this compile problem with RStan 2.2 (and began with RStan 2.1.1) on some Macs. Several of my students have been experiencing this issue, which is how it came to my attention. The pattern is that RStan compiles fine, but when compiling a model, it throws a messy error that begins with
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created!
It goes on for a while. I'll attach a full example as a text file. (Top of file has the relevant g++ -v output.)
I finally had a chance to sit down and try to isolate the issue. I think the problem is isolated to g++ 4.2.x, as I have been able to fix it by using clang++ to build Rstan, both under 10.7.x and 10.8.x (I dare not install 10.9, as everyone says it's evil).
So provided one has clang installed, all that's needed to fix the problem is to edit ~/.R/Makevars to include:
Then remove RStan and recompile.
If this does indeed fix it for everyone, then maybe not worth fixing, as clang is available for everyone. But it is definitely worth putting a big flashing signal on RStan wiki about it, so everyone adds CXX=clang++ to their Makevars.