Compiling issue with stan in the R package 'brms'

I’m looking for help to implement Rtools/stan through the ‘brms’ R package. After following the instructions for installing Rtools, ensuring that the rstan tool chain works, and reinstalling R, R Studio, and rstan, I’m still not able to have the compiler called correctly. All of the checks on the rstan github page work (https://github.com/stan-dev/rstan/wiki/Installing-RStan-on-Windows#toolchain) with proper locations for each item.

I’m using R version 3.4.3 and Rtools34, with g++ v. 4.9.3 called.

When I call the brm() function from ‘brms’, it starts to work (‘Compiling the C++ model’), but I eventually reach the following error:

Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from C:/…/R/win-library/3.3/BH/include/boost/config.hpp:39:0,
from C:/…/R/win-library/3.3/BH/include/boost/math/tools/config.hpp:13

with a number of other files as well. I’ve searched for this error online, and have reinstalled these files to no avail.

Any ideas?

Emma

Edit: Whole error message

Compiling the C++ model
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from C:/Users/SYLVESTERE/Documents/R/win-library/3.3/BH/include/boost/config.hpp:39:0,
from C:/…/Documents/R/win-library/3.3/BH/include/boost/math/tools/config.hpp:13,
from C:/…/Documents/R/win-library/3.3/StanHeaders/include/stan/math/rev/core/var.hpp:7,
from C:/…/Documents/R/win-library/3.3/StanHeaders/include/stan/math/rev/core/gevv_vvv_vari.hpp:5,
from C:/…/Documents/R/win-library/3.3/StanHeaders/include/stan/math/rev/core.hpp:12,
from C:/…/Documents/R/win-library/3.3/StanHeaders/include/stan/math/rev/mat.hpp:4,
from C:/…/Documents/R/win-library/3.3/StanHeaders/include/stan/math.hpp:4,
from C:/…/Documents/R/win-library/3.3/StanHeaders/include/src/stan/model/model_header.hpp:4,

In addition: Warning message:
running command ‘C:/PROGRA~1/R/R-33~1.3/bin/x64/R CMD SHLIB file2b8c5304240c.cpp 2> file2b8c5304240c.cpp.err.txt’ had status 1

We need to see the whole error message, but at this point I would guess that you need to make sure that your ~/.R/Makevars file does not have -mtune=native -march=native anywhere in it.

~/.R/Makevars file contains:

CXXFLAGS = -O3 -Wall $(DEBUGFLAG) -mtune=core2 #set_by_rstan
R_XTRA_CPPFLAGS = -I"$(R_HOME)/include" #set_by_rstan
CXXFLAGS=-O3

You may need to remove that -mtune=core2.

I removed that from the Makevars file. Still no change to the error message.
Any other ideas?

posting the full error message

I edited the question with the full error message already. That’s all there is.

Am I missing an error message that might be elsewhere?

There should be more to it, yet. Can you paste the output of

stan_model(file.stan, verbose = TRUE)`