Error when running stan command

Operating System: Windows 7
Interface Version: R3.4.1Patched
Output of writeLines(readLines(file.path(Sys.getenv(“HOME”), “.R/Makevars”))):

## With Rcpp 0.11.0 and later, we no longer need to set PKG_LIBS as there is
## no user-facing library. The include path to headers is already set by R.
#PKG_LIBS = 

## With R 3.1.0 or later, you can uncomment the following line to tell R to 
## enable compilation with C++11 (or even C++14) where available
CXX_STD = CXX11
#CXXFLAGS = "-Wno-macro-redefined -Wunused-function"
#CXXFLAGS=-O3 -Wno-unused-variable -Wno-unused-function
CXXFLAGS=-O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function
CXXFLAGS=-O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function
CXXFLAGS += -Wno-ignored-attributes -Wno-deprecated-declarations

Output of devtools::session_info("rstan”):
Session info ------------------------------------------------------------------
 setting  value
 version  R version 3.4.1 (2017-06-30)
 system   x86_64, mingw32
 ui       RTerm
 language (EN)
 collate  Dutch_Netherlands.1252
 tz       Europe/Berlin
 date     2017-09-05

Packages ----------------------------------------------------------------------
 package      * version   date       source
 BH             1.65.0-1  2017-08-24 CRAN (R 3.4.1)
 colorspace     1.3-2     2016-12-14 CRAN (R 3.4.1)
 dichromat      2.0-0     2013-01-24 CRAN (R 3.4.0)
 digest         0.6.12    2017-01-27 CRAN (R 3.4.1)
 ggplot2        2.2.1     2016-12-30 CRAN (R 3.4.0)
 graphics     * 3.4.1     2017-08-04 local
 grDevices    * 3.4.1     2017-08-04 local
 grid           3.4.1     2017-08-04 local
 gridExtra      2.2.1     2016-02-29 CRAN (R 3.4.1)
 gtable         0.2.0     2016-02-26 CRAN (R 3.4.0)
 inline         0.3.14    2015-04-13 CRAN (R 3.4.1)
 labeling       0.3       2014-08-23 CRAN (R 3.4.0)
 lattice        0.20-35   2017-03-25 CRAN (R 3.4.1)
 lazyeval       0.2.0     2016-06-12 CRAN (R 3.4.0)
 magrittr       1.5       2014-11-22 CRAN (R 3.4.0)
 MASS           7.3-47    2017-04-21 CRAN (R 3.4.1)
 Matrix         1.2-11    2017-08-16 CRAN (R 3.4.1)
 methods      * 3.4.1     2017-08-04 local
 munsell        0.4.3     2016-02-13 CRAN (R 3.4.0)
 plyr           1.8.4     2016-06-08 CRAN (R 3.4.0)
 R6             2.2.2     2017-06-17 CRAN (R 3.4.1)
 RColorBrewer   1.1-2     2014-12-07 CRAN (R 3.4.0)
 Rcpp           0.12.12   2017-07-15 CRAN (R 3.4.1)
 RcppEigen      0.3.3.3.0 2017-05-01 CRAN (R 3.4.1)
 reshape2       1.4.2     2016-10-22 CRAN (R 3.4.0)
 rlang          0.1.2     2017-08-09 CRAN (R 3.4.1)
 rstan          2.16.2    2017-07-03 CRAN (R 3.4.1)
 scales         0.5.0     2017-08-24 CRAN (R 3.4.1)
 StanHeaders    2.16.0-1  2017-07-03 CRAN (R 3.4.1)
 stats        * 3.4.1     2017-08-04 local
 stats4         3.4.1     2017-08-04 local
 stringi        1.1.5     2017-04-07 CRAN (R 3.4.0)
 stringr        1.2.0     2017-02-18 CRAN (R 3.4.1)
 tibble         1.3.4     2017-08-22 CRAN (R 3.4.1)
 tools          3.4.1     2017-08-04 local
 utils        * 3.4.1     2017-08-04 local
 viridisLite    0.2.0     2017-03-24 CRAN (R 3.4.1)

When running a simple stan model I get the following errors (lots of them):

C:/Users/HG/R/win-library/3.4/BH/include/boost/math/special_functions/detail/bessel_k1.hpp:333:13: note: in expansion of macro 'BOOST_MATH_BIG_CONSTANT'
             BOOST_MATH_BIG_CONSTANT(T, 64, 6.321900849331506946977e-01),
             ^
C:/Users/HG/R/win-library/3.4/BH/include/boost/math/tools/big_constant.hpp:74:46: note: candidate is:
       boost::is_convertible<const char*, T>())
                                              ^
C:/Users/HG/R/win-library/3.4/BH/include/boost/math/special_functions/detail/bessel_k1.hpp:333:13: note: in expansion of macro 'BOOST_MATH_BIG_CONSTANT'
             BOOST_MATH_BIG_CONSTANT(T, 64, 6.321900849331506946977e-01),
             ^
C:/Users/HG/R/win-library/3.4/BH/include/boost/math/tools/big_constant.hpp:51:10: note: template<class T> T boost::math::tools::make_big_value(boost::math::tools::largest_float, const char*, const false_&, const false_&)
 inline T make_big_value(largest_float, const char* s, mpl::false_ const&, mpl::false_ const&)
          ^
C:/Users/HG/R/win-library/3.4/BH/include/boost/math/tools/big_constant.hpp:51:10: note:   template argument deduction/substitution failed:
C:/Users/HG/R/win-library/3.4/BH/include/boost/math/tools/big_constant.hpp:74:46: note:   cannot convert 'mpl_::bool_<true>()' (type 'mpl_::bool_<true>') to type 'const false_& {aka const mpl_::bool_<false>&}'
       boost::is_convertible<const char*, T>())
                                              ^
C:/Users/HG/R/win-library/3.4/BH/include/boost/math/special_functions/detail/bessel_k1.hpp:333:13: note: in expansion of macro 'BOOST_MATH_BIG_CONSTANT'
             BOOST_MATH_BIG_CONSTANT(T, 64, 6.321900849331506946977e-01),

Loads of them.

The last lines of all the errors are:

443: // declarations
444: extern "C" {
445: SEXP file21050af7616( ) ;
446: }
447: 
448: // definition
449: 
450: SEXP file21050af7616(  ){
451:  return Rcpp::wrap("f33184c3890b7cc409dc39ccab017188");
452: }
453: 
454: 
Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! In file included from C:/Users/nl19856/R/win-library/3.4/BH/include/boost/type_traits/is_integral.hpp:13:0,
                 from C:/Users/nl19856/R/win-library/3.4/BH/include/boost/math/tools/config.hpp:17,
                 from C:/Users/nl19856/R/win-library/3.4/StanHeaders/include/stan/math/rev/core/var.hpp:7,
                 from C:/Users/nl19856/R/win-library/3.4/StanHeaders/include/stan/math/rev/core/gevv_vvv_vari.hpp:5,
                 from C:/Users/nl19856/R/win-library/3.4/StanHeaders/include/stan/math/rev/core.hpp:12,
                 from C:/Users/nl19856/R/win-library/3.4/StanHeaders/include/stan/math/rev/mat.hpp:4,
                 from C:/Users/nl19856/R/win-library/3.4/StanHeaders/include/stan/math.hpp:4,
                 from C:/Users/nl19856/R/win-library/3.4/StanHeaders/include/src/stan/model/model_header.hpp:4,
                 from file21050af7616.cpp:8:
C:/Users/nl19856/R/win-library/3.4/BH/include/b
In addition: Warning message:
running command 'C:/PROGRA~1/R/R-34~1.1PA/bin/x64/R CMD SHLIB file21050af7616.cpp 2> file21050af7616.cpp.err.txt' had status 1 
> 

Any clues what is wrong?
I tried different contents of Makevars but that did not help.

Regards Hans

[edit: escaped output]

These say “note”—they’re not errors. They’re also not under our control as they come from the Boost through the BH package.

I don’t know much about RStan and can’t tell if there’s a problem with our parser/compiler without seeing the Stan program you’re trying to run. We’re good at guessing, but not that good!

@bgoodri or @jonah may know what’s up if it’s a problem with R. If they don’t respond, I’d suggest opening an issue against RStan with your program so that there’s a chance of reproducing the problem you’re having.