Compilation error with 8 schools example


#1

Hello. I am a new user and am trying to get RStan to work. I did my best to follow the directions for installing Stan and using it with R, including multiple reinstalls. Please see below for a detailed account of the issue.

Operating System: Windows 10

Interface Version: R 3.4.0; RStudio 1.0.143; Stan 2.15.1; Rtools 3.3

Output of writeLines(readLines(file.path(Sys.getenv(“HOME”), “.R/Makevars”))):
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”): +

I followed the directions exactly as described here: https://github.com/stan-dev/rstan/wiki/Installing-RStan-on-Windows

Everything seems to install properly. Here is the output from the “test commands”:

Sys.getenv(‘PATH’):
"C:\Program Files\R\R-3.4.0\bin\i386;c:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin;c:\Rtools\bin;c:\Rtools\mingw_32…

system(‘g++ -v’):
Using built-in specs.
COLLECT_GCC=c:\Rtools\GCC-46~1.3\bin\G__~1.EXE
COLLECT_LTO_WRAPPER=c:/rtools/gcc-46~1.3/bin/…/libexec/gcc/i686-w64-mingw32/4.6.3/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: /data/gannet/ripley/Sources/mingw-test3/src/gcc/configure --host=i686-w64-mingw32 --build=x86_64-linux-gnu --target=i686-w64-mingw32 --with-sysroot=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/mingw32 --prefix=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/mingw32 --with-gmp=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/prereq_install --with-mpfr=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/prereq_install --with-mpc=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/prereq_install --disable-shared --enable-static --enable-targets=all --enable-languages=c,c++,fortran --enable-libgomp --enable-sjlj-exceptions --enable-fully-dynamic-string --disable-nls --disable-werror --enable-checking=release --disable-win32-registry --disable-rpath --disable-werror CFLAGS=’-O2 -mtune=core2 -fomit-frame-pointer’ LDFLAGS=
Thread model: win32
gcc version 4.6.3 20111208 (prerelease) (GCC)

system(‘where make’):
c:\Rtools\bin\make.exe

fx <- inline::cxxfunction( signature(x = “integer”, y = “numeric” ) , ’

  • return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ;
  •                        ' )
    

fx( 2L, 5 )
[1] 10

When I run the 8 schools example,however, I get the following code and error:

library(“rstan”)
Loading required package: ggplot2
Loading required package: StanHeaders
rstan (Version 2.15.1, packaged: 2017-04-19 05:03:57 UTC, GitRev: 2e1f913d3ca3)
For execution on a local, multicore CPU with excess RAM we recommend calling
rstan_options(auto_write = TRUE)
options(mc.cores = parallel::detectCores())

schools_dat <- list(J = 8,

  •                 y = c(28,  8, -3,  7, -1,  1, 18, 12),
    
  •                 sigma = c(15, 10, 16, 11,  9, 11, 10, 18))
    

fit <- stan(file = ‘schools.stan’, data = schools_dat,

  •         iter = 1000, chains = 4)
    

In file included from C:/Users/User Name/Documents/R/win-library/3.4/BH/include/boost/config.hpp:39:0,
from C:/Users/User Name/Documents/R/win-library/3.4/BH/include/boost/math/tools/config.hpp:13,
from C:/Users/User Name/Documents/R/win-library/3.4/StanHeaders/include/stan/math/rev/core/var.hpp:7,
from C:/Users/User Name/Documents/R/win-library/3.4/StanHeaders/include/stan/math/rev/core/gevv_vvv_vari.hpp:5,
from C:/Users/User Name/Documents/R/win-library/3.4/StanHeaders/include/stan/math/rev/core.hpp:12,
from C:/Users/User Name/Documents/R/win-library/3.4/StanHeaders/include/stan/math/rev/mat.hpp:4,
from C:/Users/User Name/Documents/R/win-library/3.4/StanHeaders/include/stan/math.hpp:4,
from C:/Users/User Name/Documents/R/win-library/3.4/StanHeaders/include/src/stan/model/model_header.hpp:4,
from file2d3855f4469c.cpp:8:
C:/Users/User Name/Documents/R/win-library/3.4/BH/include/boost/config/compiler/gcc.hpp:186:0: warning: “BOOST_NO_CXX11_RVALUE_REFERENCES” redefined

define BOOST_NO_CXX11_RVALUE_REFERENCES

^
:0:0: note: this is the location of the previous definition
In file included from C:/Users/User Name/Documents/R/win-library/3.4/RcppEigen/include/Eigen/Core:363:0,
from C:/Users/User Name/Documents/R/win-library/3.4/RcppEigen/include/Eigen/Dense:1,
from C:/Users/User Name/Documents/R/win-library/3.4/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:4,
from C:/Users/User Name/Documents/R/win-library/3.4/StanHeaders/include/stan/math/rev/mat/fun/Eigen_NumTraits.hpp:4,
from C:/Users/User Name/Documents/R/win-library/3.4/StanHeaders/include/stan/math/rev/core/matrix_vari.hpp:4,
from C:/Users/User Name/Documents/R/win-library/3.4/StanHeaders/include/stan/math/rev/core.hpp:14,
from C:/Users/User Name/Documents/R/win-library/3.4/StanHeaders/include/stan/math/rev/mat.hpp:4,
from C:/Users/User Name/Documents/R/win-library/3.4/StanHeaders/include/stan/math.hpp:4,
from C:/Users/User Name/Documents/R/win-library/3.4/StanHeaders/include/src/stan/model/model_header.hpp:4,
from file2d3855f4469c.cpp:8:
C:/Users/User Name/Documents/R/win-library/3.4/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h: In static member function ‘static void Eigen::internal::general_matrix_vector_product<Index, LhsScalar, LhsMapper, 0, ConjugateLhs, RhsScalar, RhsMapper, ConjugateRhs, Version>::run(Index, Index, const LhsMapper&, const RhsMapper&, Eigen::internal::general_matrix_vector_product<Index, LhsScalar, LhsMapper, 0, ConjugateLhs, RhsScalar, RhsMapper, ConjugateRhs, Version>::ResScalar*, Index, RhsScalar) [with Index = int; LhsScalar = double; LhsMapper = Eigen::internal::const_blas_data_mapper<double, int, 0>; bool ConjugateLhs = false; RhsScalar = double; RhsMapper = Eigen::internal::const_blas_data_mapper<double, int, 1>; bool ConjugateRhs = false; int Version = 0; Eigen::internal::general_matrix_vector_product<Index, LhsScalar, LhsMapper, 0, ConjugateLhs, RhsScalar, RhsMapper, ConjugateRhs, Version>::ResScalar = double]’:
C:/Users/User Name/Documents/R/win-library/3.4/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:871:21: internal compiler error: in expand_expr_real_2, at expr.c:8569
return ::fma(a,b,c);
^
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See http://sourceforge.net/projects/mingw-w64 for instructions.
make: *** [file2d3855f4469c.o] Error 1
Warning message:
running command ‘make -f “C:/PROGRA~1/R/R-34~1.0/etc/i386/Makeconf” -f “C:/PROGRA~1/R/R-34~1.0/share/make/winshlib.mk” -f “C:/Users/User Name/Documents/.R/Makevars” SHLIB_LDFLAGS=’$(SHLIB_CXXLDFLAGS)’ SHLIB_LD=’$(SHLIB_CXXLD)’ SHLIB=“file2d3855f4469c.dll” OBJECTS=“file2d3855f4469c.o”’ had status 2

ERROR(s) during compilation: source code errors or compiler configuration errors!

Program source:
1:
2: // includes from the plugin
3:
4:
5: // user includes
6: #define STAN__SERVICES__COMMAND_HPP// Code generated by Stan version 2.15.0
7:
8: #include <stan/model/model_header.hpp>
9:
10: namespace model2d382df34bb6_schools_namespace {
11:
12: using std::istream;
13: using std::string;
14: using std::stringstream;
15: using std::vector;
16: using stan::io::dump;
17: using stan::math::lgamma;
18: using stan::model::prob_grad;
19: using namespace stan::math;
20:
21: typedef Eigen::Matrix<double,Eigen::Dynamic,1> vector_d;
22: typedef Eigen::Matrix<double,1,Eigen::Dynamic> row_vector_d;
23: typedef Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic> matrix_d;
24:
25: static int current_statement_begin__;
26:
27: class model2d382df34bb6_schools : public prob_grad {
28: private:
29: int J;
30: vector y;
31: vector sigma;
32: public:
33: model2d382df34bb6_schools(stan::io::var_context& context__,
34: std::ostream* pstream__ = 0)
35: : prob_grad(0) {
36: typedef boost::ecuyer1988 rng_t;
37: rng_t base_rng(0); // 0 seed default
38: ctor_body(context__, base_rng, pstream__);
39: }
40:
41: template
42: model2d382df34bb6_schools(stan::io::var_context& context__,
43: RNG& base_rng__,
44: std::ostream* pstream__ = 0)
45: : prob_grad(0) {
46: ctor_body(context__, base_rng__, pstream__);
47: }
48:
49: template
50: void ctor_body(stan::io::var_context& context__,
51: RNG& base_rng__,
52: std::ostream* pstream__) {
53: current_statement_begin__ = -1;
54:
55: static const char* function__ = “model2d382df34bb6_schools_namespace::model2d382df34bb6_schools”;
56: (void) function__; // dummy to suppress unused var warning
57: size_t pos__;
58: (void) pos__; // dummy to suppress unused var warning
59: std::vector vals_i__;
60: std::vector vals_r__;
61: double DUMMY_VAR__(std::numeric_limits::quiet_NaN());
62: (void) DUMMY_VAR__; // suppress unused var warning
63:
64: // initialize member variables
65: context__.validate_dims(“data initialization”, “J”, “int”, context__.to_vec());
66: J = int(0);
67: vals_i__ = context__.vals_i(“J”);
68: pos__ = 0;
69: J = vals_i__[pos__++];
70: validate_non_negative_index(“y”, “J”, J);
71: context__.validate_dims(“data initialization”, “y”, “double”, context__.to_vec(J));
72: validate_non_negative_index(“y”, “J”, J);
73: y = std::vector(J,double(0));
74: vals_r__ = context__.vals_r(“y”);
75: pos__ = 0;
76: size_t y_limit_0__ = J;
77: for (size_t i_0__ = 0; i_0__ < y_limit_0__; ++i_0__) {
78: y[i_0__] = vals_r__[pos__++];
79: }
80: validate_non_negative_index(“sigma”, “J”, J);
81: context__.validate_dims(“data initialization”, “sigma”, “double”, context__.to_vec(J));
82: validate_non_negative_index(“sigma”, “J”, J);
83: sigma = std::vector(J,double(0));
84: vals_r__ = context__.vals_r(“sigma”);
85: pos__ = 0;
86: size_t sigma_limit_0__ = J;
87: for (size_t i_0__ = 0; i_0__ < sigma_limit_0__; ++i_0__) {
88: sigma[i_0__] = vals_r__[pos__++];
89: }
90:
91: // validate, data variables
92: check_greater_or_equal(function__,“J”,J,0);
93: for (int k0__ = 0; k0__ < J; ++k0__) {
94: check_greater_or_equal(function__,“sigma[k0__]”,sigma[k0__],0);
95: }
96: // initialize data variables
97:
98: try {
99: } catch (const std::exception& e) {
100: stan::lang::rethrow_located(e,current_statement_begin__);
101: // Next line prevents compiler griping about no return
102: throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ");
103: }
104:
105: // validate transformed data
106:
107: // validate, set parameter ranges
108: num_params_r__ = 0U;
109: param_ranges_i__.clear();
110: ++num_params_r__;
111: ++num_params_r__;
112: validate_non_negative_index(“eta”, “J”, J);
113: num_params_r__ += J;
114: }
115:
116: ~model2d382df34bb6_schools() { }
117:
118:
119: void transform_inits(const stan::io::var_context& context__,
120: std::vector& params_i__,
121: std::vector& params_r__,
122: std::ostream
pstream__) const {
123: stan::io::writer writer__(params_r__,params_i__);
124: size_t pos__;
125: (void) pos__; // dummy call to supress warning
126: std::vector vals_r__;
127: std::vector vals_i__;
128:
129: if (!(context__.contains_r(“mu”)))
130: throw std::runtime_error(“variable mu missing”);
131: vals_r__ = context__.vals_r(“mu”);
132: pos__ = 0U;
133: context__.validate_dims(“initialization”, “mu”, “double”, context__.to_vec());
134: // generate_declaration mu
135: double mu(0);
136: mu = vals_r__[pos__++];
137: try {
138: writer__.scalar_unconstrain(mu);
139: } catch (const std::exception& e) {
140: throw std::runtime_error(std::string("Error transforming variable mu: ") + e.what());
141: }
142:
143: if (!(context__.contains_r(“tau”)))
144: throw std::runtime_error(“variable tau missing”);
145: vals_r__ = context__.vals_r(“tau”);
146: pos__ = 0U;
147: context__.validate_dims(“initialization”, “tau”, “double”, context__.to_vec());
148: // generate_declaration tau
149: double tau(0);
150: tau = vals_r__[pos__++];
151: try {
152: writer__.scalar_lb_unconstrain(0,tau);
153: } catch (const std::exception& e) {
154: throw std::runtime_error(std::string("Error transforming variable tau: ") + e.what());
155: }
156:
157: if (!(context__.contains_r(“eta”)))
158: throw std::runtime_error(“variable eta missing”);
159: vals_r__ = context__.vals_r(“eta”);
160: pos__ = 0U;
161: validate_non_negative_index(“eta”, “J”, J);
162: context__.validate_dims(“initialization”, “eta”, “double”, context__.to_vec(J));
163: // generate_declaration eta
164: std::vector eta(J,double(0));
165: for (int i0__ = 0U; i0__ < J; ++i0__)
166: eta[i0__] = vals_r__[pos__++];
167: for (int i0__ = 0U; i0__ < J; ++i0__)
168: try {
169: writer__.scalar_unconstrain(eta[i0__]);
170: } catch (const std::exception& e) {
171: throw std::runtime_error(std::string("Error transforming variable eta: ") + e.what());
172: }
173:
174: params_r__ = writer__.data_r();
175: params_i__ = writer__.data_i();
176: }
177:
178: void transform_inits(const stan::io::var_context& context,
179: Eigen::Matrix<double,Eigen::Dynamic,1>& params_r,
180: std::ostream
pstream__) const {
181: std::vector params_r_vec;
182: std::vector params_i_vec;
183: transform_inits(context, params_i_vec, params_r_vec, pstream__);
184: params_r.resize(params_r_vec.size());
185: for (int i = 0; i < params_r.size(); ++i)
186: params_r(i) = params_r_vec[i];
187: }
188:
189:
190: template <bool propto__, bool jacobian__, typename T__>
191: T__ log_prob(vector<T__>& params_r__,
192: vector& params_i__,
193: std::ostream
pstream__ = 0) const {
194:
195: T__ DUMMY_VAR__(std::numeric_limits::quiet_NaN());
196: (void) DUMMY_VAR__; // suppress unused var warning
197:
198: T__ lp__(0.0);
199: stan::math::accumulator<T__> lp_accum__;
200:
201: // model parameters
202: stan::io::reader<T__> in__(params_r__,params_i__);
203:
204: T__ mu;
205: (void) mu; // dummy to suppress unused var warning
206: if (jacobian__)
207: mu = in__.scalar_constrain(lp__);
208: else
209: mu = in__.scalar_constrain();
210:
211: T__ tau;
212: (void) tau; // dummy to suppress unused var warning
213: if (jacobian__)
214: tau = in__.scalar_lb_constrain(0,lp__);
215: else
216: tau = in__.scalar_lb_constrain(0);
217:
218: vector<T__> eta;
219: size_t dim_eta_0__ = J;
220: eta.reserve(dim_eta_0__);
221: for (size_t k_0__ = 0; k_0__ < dim_eta_0__; ++k_0__) {
222: if (jacobian__)
223: eta.push_back(in__.scalar_constrain(lp__));
224: else
225: eta.push_back(in__.scalar_constrain());
226: }
227:
228:
229: // transformed parameters
230: validate_non_negative_index(“theta”, “J”, J);
231: vector<T__> theta(J);
232: stan::math::initialize(theta, DUMMY_VAR__);
233: stan::math::fill(theta,DUMMY_VAR__);
234:
235:
236: try {
237: current_statement_begin__ = 13;
238: for (int j = 1; j <= J; ++j) {
239: current_statement_begin__ = 14;
240: stan::math::assign(get_base1_lhs(theta,j,“theta”,1), (mu + (tau * get_base1(eta,j,“eta”,1))));
241: }
242: } catch (const std::exception& e) {
243: stan::lang::rethrow_located(e,current_statement_begin__);
244: // Next line prevents compiler griping about no return
245: throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ");
246: }
247:
248: // validate transformed parameters
249: for (int i0__ = 0; i0__ < J; ++i0__) {
250: if (stan::math::is_uninitialized(theta[i0__])) {
251: std::stringstream msg__;
252: msg__ << “Undefined transformed parameter: theta” << ‘[’ << i0__ << ‘]’;
253: throw std::runtime_error(msg__.str());
254: }
255: }
256:
257: const char
function__ = “validate transformed params”;
258: (void) function__; // dummy to suppress unused var warning
259:
260: // model body
261: try {
262:
263: current_statement_begin__ = 17;
264: lp_accum__.add(normal_log(eta,0,1));
265: current_statement_begin__ = 18;
266: lp_accum__.add(normal_log(y,theta,sigma));
267: } catch (const std::exception& e) {
268: stan::lang::rethrow_located(e,current_statement_begin__);
269: // Next line prevents compiler griping about no return
270: throw std::runtime_error("
* IF YOU SEE THIS, PLEASE REPORT A BUG ");
271: }
272:
273: lp_accum__.add(lp__);
274: return lp_accum__.sum();
275:
276: } // log_prob()
277:
278: template <bool propto, bool jacobian, typename T_>
279: T_ log_prob(Eigen::Matrix<T_,Eigen::Dynamic,1>& params_r,
280: std::ostream
pstream = 0) const {
281: std::vector<T_> vec_params_r;
282: vec_params_r.reserve(params_r.size());
283: for (int i = 0; i < params_r.size(); ++i)
284: vec_params_r.push_back(params_r(i));
285: std::vector vec_params_i;
286: return log_prob<propto,jacobian,T_>(vec_params_r, vec_params_i, pstream);
287: }
288:
289:
290: void get_param_names(std::vectorstd::string& names__) const {
291: names__.resize(0);
292: names__.push_back(“mu”);
293: names__.push_back(“tau”);
294: names__.push_back(“eta”);
295: names__.push_back(“theta”);
296: }
297:
298:
299: void get_dims(std::vector<std::vector<size_t> >& dimss__) const {
300: dimss__.resize(0);
301: std::vector<size_t> dims__;
302: dims__.resize(0);
303: dimss__.push_back(dims__);
304: dims__.resize(0);
305: dimss__.push_back(dims__);
306: dims__.resize(0);
307: dims__.push_back(J);
308: dimss__.push_back(dims__);
309: dims__.resize(0);
310: dims__.push_back(J);
311: dimss__.push_back(dims__);
312: }
313:
314: template
315: void write_array(RNG& base_rng__,
316: std::vector& params_r__,
317: std::vector& params_i__,
318: std::vector& vars__,
319: bool include_tparams__ = true,
320: bool include_gqs__ = true,
321: std::ostream
pstream__ = 0) const {
322: vars__.resize(0);
323: stan::io::reader in__(params_r__,params_i__);
324: static const char
function__ = “model2d382df34bb6_schools_namespace::write_array”;
325: (void) function__; // dummy to suppress unused var warning
326: // read-transform, write parameters
327: double mu = in__.scalar_constrain();
328: double tau = in__.scalar_lb_constrain(0);
329: vector eta;
330: size_t dim_eta_0__ = J;
331: for (size_t k_0__ = 0; k_0__ < dim_eta_0__; ++k_0__) {
332: eta.push_back(in__.scalar_constrain());
333: }
334: vars__.push_back(mu);
335: vars__.push_back(tau);
336: for (int k_0__ = 0; k_0__ < J; ++k_0__) {
337: vars__.push_back(eta[k_0__]);
338: }
339:
340: if (!include_tparams__) return;
341: // declare and define transformed parameters
342: double lp__ = 0.0;
343: (void) lp__; // dummy to suppress unused var warning
344: stan::math::accumulator lp_accum__;
345:
346: double DUMMY_VAR__(std::numeric_limits::quiet_NaN());
347: (void) DUMMY_VAR__; // suppress unused var warning
348:
349: validate_non_negative_index(“theta”, “J”, J);
350: vector theta(J, 0.0);
351: stan::math::initialize(theta, std::numeric_limits::quiet_NaN());
352: stan::math::fill(theta,DUMMY_VAR__);
353:
354:
355: try {
356: current_statement_begin__ = 13;
357: for (int j = 1; j <= J; ++j) {
358: current_statement_begin__ = 14;
359: stan::math::assign(get_base1_lhs(theta,j,“theta”,1), (mu + (tau * get_base1(eta,j,“eta”,1))));
360: }
361: } catch (const std::exception& e) {
362: stan::lang::rethrow_located(e,current_statement_begin__);
363: // Next line prevents compiler griping about no return
364: throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ");
365: }
366:
367: // validate transformed parameters
368:
369: // write transformed parameters
370: for (int k_0__ = 0; k_0__ < J; ++k_0__) {
371: vars__.push_back(theta[k_0__]);
372: }
373:
374: if (!include_gqs__) return;
375: // declare and define generated quantities
376:
377:
378: try {
379: } catch (const std::exception& e) {
380: stan::lang::rethrow_located(e,current_statement_begin__);
381: // Next line prevents compiler griping about no return
382: throw std::runtime_error("
IF YOU SEE THIS, PLEASE REPORT A BUG ");
383: }
384:
385: // validate generated quantities
386:
387: // write generated quantities
388: }
389:
390: template
391: void write_array(RNG& base_rng,
392: Eigen::Matrix<double,Eigen::Dynamic,1>& params_r,
393: Eigen::Matrix<double,Eigen::Dynamic,1>& vars,
394: bool include_tparams = true,
395: bool include_gqs = true,
396: std::ostream
pstream = 0) const {
397: std::vector params_r_vec(params_r.size());
398: for (int i = 0; i < params_r.size(); ++i)
399: params_r_vec[i] = params_r(i);
400: std::vector vars_vec;
401: std::vector params_i_vec;
402: write_array(base_rng,params_r_vec,params_i_vec,vars_vec,include_tparams,include_gqs,pstream);
403: vars.resize(vars_vec.size());
404: for (int i = 0; i < vars.size(); ++i)
405: vars(i) = vars_vec[i];
406: }
407:
408: static std::string model_name() {
409: return “model2d382df34bb6_schools”;
410: }
411:
412:
413: void constrained_param_names(std::vectorstd::string& param_names__,
414: bool include_tparams__ = true,
415: bool include_gqs__ = true) const {
416: std::stringstream param_name_stream__;
417: param_name_stream__.str(std::string());
418: param_name_stream__ << “mu”;
419: param_names__.push_back(param_name_stream__.str());
420: param_name_stream__.str(std::string());
421: param_name_stream__ << “tau”;
422: param_names__.push_back(param_name_stream__.str());
423: for (int k_0__ = 1; k_0__ <= J; ++k_0__) {
424: param_name_stream__.str(std::string());
425: param_name_stream__ << “eta” << ‘.’ << k_0__;
426: param_names__.push_back(param_name_stream__.str());
427: }
428:
429: if (!include_gqs__ && !include_tparams__) return;
430: for (int k_0__ = 1; k_0__ <= J; ++k_0__) {
431: param_name_stream__.str(std::string());
432: param_name_stream__ << “theta” << ‘.’ << k_0__;
433: param_names__.push_back(param_name_stream__.str());
434: }
435:
436: if (!include_gqs__) return;
437: }
438:
439:
440: void unconstrained_param_names(std::vectorstd::string& param_names__,
441: bool include_tparams__ = true,
442: bool include_gqs__ = true) const {
443: std::stringstream param_name_stream__;
444: param_name_stream__.str(std::string());
445: param_name_stream__ << “mu”;
446: param_names__.push_back(param_name_stream__.str());
447: param_name_stream__.str(std::string());
448: param_name_stream__ << “tau”;
449: param_names__.push_back(param_name_stream__.str());
450: for (int k_0__ = 1; k_0__ <= J; ++k_0__) {
451: param_name_stream__.str(std::string());
452: param_name_stream__ << “eta” << ‘.’ << k_0__;
453: param_names__.push_back(param_name_stream__.str());
454: }
455:
456: if (!include_gqs__ && !include_tparams__) return;
457: for (int k_0__ = 1; k_0__ <= J; ++k_0__) {
458: param_name_stream__.str(std::string());
459: param_name_stream__ << “theta” << ‘.’ << k_0__;
460: param_names__.push_back(param_name_stream__.str());
461: }
462:
463: if (!include_gqs__) return;
464: }
465:
466: }; // model
467:
468: }
469:
470: typedef model2d382df34bb6_schools_namespace::model2d382df34bb6_schools stan_model;
471:
472: #include <rstan/rstaninc.hpp>
473: /

474: * Define Rcpp Module to expose stan_fit’s functions to R.
475: */
476: RCPP_MODULE(stan_fit4model2d382df34bb6_schools_mod){
477: Rcpp::class_<rstan::stan_fit<model2d382df34bb6_schools_namespace::model2d382df34bb6_schools,
478: boost::random::ecuyer1988> >(“stan_fit4model2d382df34bb6_schools”)
479: // .constructorRcpp::List()
480: .constructor<SEXP, SEXP>()
481: // .constructor<SEXP, SEXP>()
482: .method(“call_sampler”,
483: &rstan::stan_fit<model2d382df34bb6_schools_namespace::model2d382df34bb6_schools, boost::random::ecuyer1988>::call_sampler)
484: .method(“param_names”,
485: &rstan::stan_fit<model2d382df34bb6_schools_namespace::model2d382df34bb6_schools, boost::random::ecuyer1988>::param_names)
486: .method(“param_names_oi”,
487: &rstan::stan_fit<model2d382df34bb6_schools_namespace::model2d382df34bb6_schools, boost::random::ecuyer1988>::param_names_oi)
488: .method(“param_fnames_oi”,
489: &rstan::stan_fit<model2d382df34bb6_schools_namespace::model2d382df34bb6_schools, boost::random::ecuyer1988>::param_fnames_oi)
490: .method(“param_dims”,
491: &rstan::stan_fit<model2d382df34bb6_schools_namespace::model2d382df34bb6_schools, boost::random::ecuyer1988>::param_dims)
492: .method(“param_dims_oi”,
493: &rstan::stan_fit<model2d382df34bb6_schools_namespace::model2d382df34bb6_schools, boost::random::ecuyer1988>::param_dims_oi)
494: .method(“update_param_oi”,
495: &rstan::stan_fit<model2d382df34bb6_schools_namespace::model2d382df34bb6_schools, boost::random::ecuyer1988>::update_param_oi)
496: .method(“param_oi_tidx”,
497: &rstan::stan_fit<model2d382df34bb6_schools_namespace::model2d382df34bb6_schools, boost::random::ecuyer1988>::param_oi_tidx)
498: .method(“grad_log_prob”,
499: &rstan::stan_fit<model2d382df34bb6_schools_namespace::model2d382df34bb6_schools, boost::random::ecuyer1988>::grad_log_prob)
500: .method(“log_prob”,
501: &rstan::stan_fit<model2d382df34bb6_schools_namespace::model2d382df34bb6_schools, boost::random::ecuyer1988>::log_prob)
502: .method(“unconstrain_pars”,
503: &rstan::stan_fit<model2d382df34bb6_schools_namespace::model2d382df34bb6_schools, boost::random::ecuyer1988>::unconstrain_pars)
504: .method(“constrain_pars”,
505: &rstan::stan_fit<model2d382df34bb6_schools_namespace::model2d382df34bb6_schools, boost::random::ecuyer1988>::constrain_pars)
506: .method(“num_pars_unconstrained”,
507: &rstan::stan_fit<model2d382df34bb6_schools_namespace::model2d382df34bb6_schools, boost::random::ecuyer1988>::num_pars_unconstrained)
508: .method(“unconstrained_param_names”,
509: &rstan::stan_fit<model2d382df34bb6_schools_namespace::model2d382df34bb6_schools, boost::random::ecuyer1988>::unconstrained_param_names)
510: .method(“constrained_param_names”,
511: &rstan::stan_fit<model2d382df34bb6_schools_namespace::model2d382df34bb6_schools, boost::random::ecuyer1988>::constrained_param_names)
512: ;
513: }
514:
515: // declarations
516: extern “C” {
517: SEXP file2d3855f4469c( ) ;
518: }
519:
520: // definition
521:
522: SEXP file2d3855f4469c( ){
523: return Rcpp::wrap(“schools”);
524: }
525:
526:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from C:/Users/User Name/Documents/R/win-library/3.4/BH/include/boost/config.hpp:39:0,
from C:/Users/User Name/Documents/R/win-library/3.4/BH/include/boost/math/tools/config.hpp:13,
from C:/Users/User Name/Documents/R/win-library/3.4/StanHeaders/include/stan/math/rev/core/var.hpp:7,
from C:/Users/User Name/Documents/R/win-library/3.4/StanHeaders/include/stan/math/rev/core/gevv_vvv_vari.hpp:5,
from C:/Users/User Name/Documents/R/win-library/3.4/StanHeaders/include/stan/math/rev/core.hpp:12,
from C:/Users/User Name/Documents/R/win-library/3.4/StanHeaders/include/stan/math/rev/mat.hpp:4,
from C:/Users/User Name/Documents/R/win-library/3.4/StanHeaders/include/stan/math.hpp:4,
from C:/Users/User Name/Documents/R/win-library/3.4/StanHeaders/include/src/stan/model/model_header.hpp:4,

In addition: Warning message:
running command ‘C:/PROGRA~1/R/R-34~1.0/bin/i386/R CMD SHLIB file2d3855f4469c.cpp 2> file2d3855f4469c.cpp.err.txt’ had status 1


#2

Try it without -mtune=native -march=native. If that still fails, try it at -O2. If that still fails, post again.


#3

That worked, bgoodri! Can you help me understand why? Thanks


#4

I don’t know why, but that is the second time someone with Windows 10, RTools 3.4, and the latest Rcpp{Eigen} has managed to produce an incomprehensible error message iff -mtune=native -march=native is included in CXXFLAGS.