Stan not running after updating to r version 4.0.2 and stan updated from 2.19.3 to 2.21

And rstan:::rstanplugin()?

With

  • .Rprofile and .Renviron empty
  • Makevars.win deleted
    the results of running example (…) and stan(“eightscools”…) remain the same, although I do not get an “Error:”

Compilation argument:
C:/R/R-40~1.2/bin/x64/R CMD SHLIB file3da859342131.cpp 2> file3da859342131.cpp.err.txt
Error in file(con, “r”) : cannot open the connection
In addition: Warning messages:
1: In file.remove(c(unprocessed, processed)) :
cannot remove file ‘C:\Users\myusername\AppData\Local\Temp\RtmpyQj4iA\file3da8669c725e.stan’, reason ‘No such file or directory’
2: In file(con, “r”) :
cannot open file ‘file3da859342131.cpp.err.txt’: No such file or directory

Looking into the temp folder I’ve noticed that the cpp file, in this example, file3da859342131.cpp, is actually created, so the compilation process seems to fail somewhere after this point…

don’t know if this observation is of any help though…
br/

If you call stan with verbose = TRUE, we can pinpoint where the compilation failed.

rstan:::rstanplugin()

$includes

[1] “// [[Rcpp::plugins(cpp14)]]\n”

$body

function (x)

x

<bytecode: 0x00000218ee9f4000>

<environment: 0x00000218ee9f3cf0>

$env

$env$LOCAL_LIBS

[1] " C:/Program Files/R/R-4.0.2/library/rstan/lib/x64/libStanServices.a -L"C:/Program Files/R/R-4.0.2/library/StanHeaders/libs/x64" -lStanHeaders -L"C:/Program Files/R/R-4.0.2/library/RcppParallel/lib/x64" -ltbb"

$env$PKG_CPPFLAGS

[1] " -I"C:/Program Files/R/R-4.0.2/library/Rcpp/include/" -I"C:/Program Files/R/R-4.0.2/library/RcppEigen/include/" -I"C:/Program Files/R/R-4.0.2/library/RcppEigen/include/unsupported" -I"C:/Program Files/R/R-4.0.2/library/BH/include" -I"C:/Program Files/R/R-4.0.2/library/StanHeaders/include/src/" -I"C:/Program Files/R/R-4.0.2/library/StanHeaders/include/" -I"C:/Program Files/R/R-4.0.2/library/RcppParallel/include/" -I"C:/Program Files/R/R-4.0.2/library/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -DSTAN_THREADS -DBOOST_NO_AUTO_PTR -include “C:/Program Files/R/R-4.0.2/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp” -std=c++1y"

image001.png

This is what I got from using verbose=TRUE

C:/rtools40/mingw64/bin/g++ -shared -s -static-libgcc -o file19a02b6e78fe.dll tmp.def file19a02b6e78fe.o C:/Program Files/R/R-4.0.2/library/rstan/lib/x64/libStanServices.a -LC:/Program Files/R/R-4.0.2/library/StanHeaders/libs/x64 -lStanHeaders -LC:/Program Files/R/R-4.0.2/library/RcppParallel/lib/x64 -ltbb -LC:/PROGRA~1/R/R-4.0.2/bin/x64 -lR

g++.exe: error: C:/Program: No such file or directory

g++.exe: error: Files/R/R-4.0.2/library/rstan/lib/x64/libStanServices.a: No such file or directory

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

Program source:

1:

2: // includes from the plugin

3: // [[Rcpp::plugins(cpp14)]]

4:

5:

6: // user includes

7: #include <Rcpp.h>

8: #include <rstan/io/rlist_ref_var_context.hpp>

9: #include <rstan/io/r_ostream.hpp>

10: #include <rstan/stan_args.hpp>

11: #include <boost/integer/integer_log2.hpp>

12: // Code generated by Stan version 2.21.0

13:

14: #include <stan/model/model_header.hpp>

15:

16: namespace model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6_namespace {

17:

18: using std::istream;

19: using std::string;

20: using std::stringstream;

21: using std::vector;

22: using stan::io::dump;

23: using stan::math::lgamma;

24: using stan::model::prob_grad;

25: using namespace stan::math;

26:

27: static int current_statement_begin__;

28:

29: stan::io::program_reader prog_reader__() {

30: stan::io::program_reader reader;

31: reader.add_event(0, 0, “start”, “model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6”);

32: reader.add_event(20, 18, “end”, “model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6”);

33: return reader;

34: }

35:

36: class model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6

37: : public stan::model::model_base_crtp<model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6> {

38: private:

39: int J;

40: std::vector y;

41: std::vector sigma;

42: public:

43: model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6(rstan::io::rlist_ref_var_context& context__,

44: std::ostream* pstream__ = 0)

45: : model_base_crtp(0) {

46: ctor_body(context__, 0, pstream__);

47: }

48:

49: model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6(stan::io::var_context& context__,

50: unsigned int random_seed__,

51: std::ostream* pstream__ = 0)

52: : model_base_crtp(0) {

53: ctor_body(context__, random_seed__, pstream__);

54: }

55:

56: void ctor_body(stan::io::var_context& context__,

57: unsigned int random_seed__,

58: std::ostream* pstream__) {

59: typedef double local_scalar_t__;

60:

61: boost::ecuyer1988 base_rng__ =

62: stan::services::util::create_rng(random_seed__, 0);

63: (void) base_rng__; // suppress unused var warning

64:

65: current_statement_begin__ = -1;

66:

67: static const char* function__ = “model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6_namespace::model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6”;

68: (void) function__; // dummy to suppress unused var warning

69: size_t pos__;

70: (void) pos__; // dummy to suppress unused var warning

71: std::vector vals_i__;

72: std::vector vals_r__;

73: local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN());

74: (void) DUMMY_VAR__; // suppress unused var warning

75:

76: try {

77: // initialize data block variables from context__

78: current_statement_begin__ = 3;

79: context__.validate_dims(“data initialization”, “J”, “int”, context__.to_vec());

80: J = int(0);

81: vals_i__ = context__.vals_i(“J”);

82: pos__ = 0;

83: J = vals_i__[pos__++];

84: check_greater_or_equal(function__, “J”, J, 0);

85:

86: current_statement_begin__ = 4;

87: validate_non_negative_index(“y”, “J”, J);

88: context__.validate_dims(“data initialization”, “y”, “double”, context__.to_vec(J));

89: y = std::vector(J, double(0));

90: vals_r__ = context__.vals_r(“y”);

91: pos__ = 0;

92: size_t y_k_0_max__ = J;

93: for (size_t k_0__ = 0; k_0__ < y_k_0_max__; ++k_0__) {

94: y[k_0__] = vals_r__[pos__++];

95: }

96:

97: current_statement_begin__ = 5;

98: validate_non_negative_index(“sigma”, “J”, J);

99: context__.validate_dims(“data initialization”, “sigma”, “double”, context__.to_vec(J));

100: sigma = std::vector(J, double(0));

101: vals_r__ = context__.vals_r(“sigma”);

102: pos__ = 0;

103: size_t sigma_k_0_max__ = J;

104: for (size_t k_0__ = 0; k_0__ < sigma_k_0_max__; ++k_0__) {

105: sigma[k_0__] = vals_r__[pos__++];

106: }

107: size_t sigma_i_0_max__ = J;

108: for (size_t i_0__ = 0; i_0__ < sigma_i_0_max__; ++i_0__) {

109: check_greater_or_equal(function__, “sigma[i_0__]”, sigma[i_0__], 0);

110: }

111:

112:

113: // initialize transformed data variables

114: // execute transformed data statements

115:

116: // validate transformed data

117:

118: // validate, set parameter ranges

119: num_params_r__ = 0U;

120: param_ranges_i__.clear();

121: current_statement_begin__ = 8;

122: num_params_r__ += 1;

123: current_statement_begin__ = 9;

124: num_params_r__ += 1;

125: current_statement_begin__ = 10;

126: validate_non_negative_index(“eta”, “J”, J);

127: num_params_r__ += J;

128: } catch (const std::exception& e) {

129: stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__());

130: // Next line prevents compiler griping about no return

131: throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***");

132: }

133: }

134:

135: ~model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6() { }

136:

137:

138: void transform_inits(const stan::io::var_context& context__,

139: std::vector& params_i__,

140: std::vector& params_r__,

141: std::ostream* pstream__) const {

142: typedef double local_scalar_t__;

143: stan::io::writer writer__(params_r__, params_i__);

144: size_t pos__;

145: (void) pos__; // dummy call to supress warning

146: std::vector vals_r__;

147: std::vector vals_i__;

148:

149: current_statement_begin__ = 8;

150: if (!(context__.contains_r(“mu”)))

151: stan::lang::rethrow_located(std::runtime_error(std::string(“Variable mu missing”)), current_statement_begin__, prog_reader__());

152: vals_r__ = context__.vals_r(“mu”);

153: pos__ = 0U;

154: context__.validate_dims(“parameter initialization”, “mu”, “double”, context__.to_vec());

155: double mu(0);

156: mu = vals_r__[pos__++];

157: try {

158: writer__.scalar_unconstrain(mu);

159: } catch (const std::exception& e) {

160: stan::lang::rethrow_located(std::runtime_error(std::string("Error transforming variable mu: ") + e.what()), current_statement_begin__, prog_reader__());

161: }

162:

163: current_statement_begin__ = 9;

164: if (!(context__.contains_r(“tau”)))

165: stan::lang::rethrow_located(std::runtime_error(std::string(“Variable tau missing”)), current_statement_begin__, prog_reader__());

166: vals_r__ = context__.vals_r(“tau”);

167: pos__ = 0U;

168: context__.validate_dims(“parameter initialization”, “tau”, “double”, context__.to_vec());

169: double tau(0);

170: tau = vals_r__[pos__++];

171: try {

172: writer__.scalar_lb_unconstrain(0, tau);

173: } catch (const std::exception& e) {

174: stan::lang::rethrow_located(std::runtime_error(std::string("Error transforming variable tau: ") + e.what()), current_statement_begin__, prog_reader__());

175: }

176:

177: current_statement_begin__ = 10;

178: if (!(context__.contains_r(“eta”)))

179: stan::lang::rethrow_located(std::runtime_error(std::string(“Variable eta missing”)), current_statement_begin__, prog_reader__());

180: vals_r__ = context__.vals_r(“eta”);

181: pos__ = 0U;

182: validate_non_negative_index(“eta”, “J”, J);

183: context__.validate_dims(“parameter initialization”, “eta”, “vector_d”, context__.to_vec(J));

184: Eigen::Matrix<double, Eigen::Dynamic, 1> eta(J);

185: size_t eta_j_1_max__ = J;

186: for (size_t j_1__ = 0; j_1__ < eta_j_1_max__; ++j_1__) {

187: eta(j_1__) = vals_r__[pos__++];

188: }

189: try {

190: writer__.vector_unconstrain(eta);

191: } catch (const std::exception& e) {

192: stan::lang::rethrow_located(std::runtime_error(std::string("Error transforming variable eta: ") + e.what()), current_statement_begin__, prog_reader__());

193: }

194:

195: params_r__ = writer__.data_r();

196: params_i__ = writer__.data_i();

197: }

198:

199: void transform_inits(const stan::io::var_context& context,

200: Eigen::Matrix<double, Eigen::Dynamic, 1>& params_r,

201: std::ostream* pstream__) const {

202: std::vector params_r_vec;

203: std::vector params_i_vec;

204: transform_inits(context, params_i_vec, params_r_vec, pstream__);

205: params_r.resize(params_r_vec.size());

206: for (int i = 0; i < params_r.size(); ++i)

207: params_r(i) = params_r_vec[i];

208: }

209:

210:

211: template <bool propto__, bool jacobian__, typename T__>

212: T__ log_prob(std::vector<T__>& params_r__,

213: std::vector& params_i__,

214: std::ostream* pstream__ = 0) const {

215:

216: typedef T__ local_scalar_t__;

217:

218: local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN());

219: (void) DUMMY_VAR__; // dummy to suppress unused var warning

220:

221: T__ lp__(0.0);

222: stan::math::accumulator<T__> lp_accum__;

223: try {

224: stan::io::reader<local_scalar_t__> in__(params_r__, params_i__);

225:

226: // model parameters

227: current_statement_begin__ = 8;

228: local_scalar_t__ mu;

229: (void) mu; // dummy to suppress unused var warning

230: if (jacobian__)

231: mu = in__.scalar_constrain(lp__);

232: else

233: mu = in__.scalar_constrain();

234:

235: current_statement_begin__ = 9;

236: local_scalar_t__ tau;

237: (void) tau; // dummy to suppress unused var warning

238: if (jacobian__)

239: tau = in__.scalar_lb_constrain(0, lp__);

240: else

241: tau = in__.scalar_lb_constrain(0);

242:

243: current_statement_begin__ = 10;

244: Eigen::Matrix<local_scalar_t__, Eigen::Dynamic, 1> eta;

245: (void) eta; // dummy to suppress unused var warning

246: if (jacobian__)

247: eta = in__.vector_constrain(J, lp__);

248: else

249: eta = in__.vector_constrain(J);

250:

251: // transformed parameters

252: current_statement_begin__ = 13;

253: validate_non_negative_index(“theta”, “J”, J);

254: Eigen::Matrix<local_scalar_t__, Eigen::Dynamic, 1> theta(J);

255: stan::math::initialize(theta, DUMMY_VAR__);

256: stan::math::fill(theta, DUMMY_VAR__);

257: stan::math::assign(theta,add(mu, multiply(tau, eta)));

258:

259: // validate transformed parameters

260: const char* function__ = “validate transformed params”;

261: (void) function__; // dummy to suppress unused var warning

262:

263: current_statement_begin__ = 13;

264: size_t theta_j_1_max__ = J;

265: for (size_t j_1__ = 0; j_1__ < theta_j_1_max__; ++j_1__) {

266: if (stan::math::is_uninitialized(theta(j_1__))) {

267: std::stringstream msg__;

268: msg__ << “Undefined transformed parameter: theta” << “(” << j_1__ << “)”;

269: stan::lang::rethrow_located(std::runtime_error(std::string("Error initializing variable theta: ") + msg__.str()), current_statement_begin__, prog_reader__());

270: }

271: }

272:

273: // model body

274:

275: current_statement_begin__ = 16;

276: lp_accum__.add(normal_log(eta, 0, 1));

277: current_statement_begin__ = 17;

278: lp_accum__.add(normal_log(y, theta, sigma));

279:

280: } catch (const std::exception& e) {

281: stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__());

282: // Next line prevents compiler griping about no return

283: throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***");

284: }

285:

286: lp_accum__.add(lp__);

287: return lp_accum__.sum();

288:

289: } // log_prob()

290:

291: template <bool propto, bool jacobian, typename T_>

292: T_ log_prob(Eigen::Matrix<T_,Eigen::Dynamic,1>& params_r,

293: std::ostream* pstream = 0) const {

294: std::vector<T_> vec_params_r;

295: vec_params_r.reserve(params_r.size());

296: for (int i = 0; i < params_r.size(); ++i)

297: vec_params_r.push_back(params_r(i));

298: std::vector vec_params_i;

299: return log_prob<propto,jacobian,T_>(vec_params_r, vec_params_i, pstream);

300: }

301:

302:

303: void get_param_names(std::vectorstd::string& names__) const {

304: names__.resize(0);

305: names__.push_back(“mu”);

306: names__.push_back(“tau”);

307: names__.push_back(“eta”);

308: names__.push_back(“theta”);

309: }

310:

311:

312: void get_dims(std::vector<std::vector<size_t> >& dimss__) const {

313: dimss__.resize(0);

314: std::vector<size_t> dims__;

315: dims__.resize(0);

316: dimss__.push_back(dims__);

317: dims__.resize(0);

318: dimss__.push_back(dims__);

319: dims__.resize(0);

320: dims__.push_back(J);

321: dimss__.push_back(dims__);

322: dims__.resize(0);

323: dims__.push_back(J);

324: dimss__.push_back(dims__);

325: }

326:

327: template

328: void write_array(RNG& base_rng__,

329: std::vector& params_r__,

330: std::vector& params_i__,

331: std::vector& vars__,

332: bool include_tparams__ = true,

333: bool include_gqs__ = true,

334: std::ostream* pstream__ = 0) const {

335: typedef double local_scalar_t__;

336:

337: vars__.resize(0);

338: stan::io::reader<local_scalar_t__> in__(params_r__, params_i__);

339: static const char* function__ = “model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6_namespace::write_array”;

340: (void) function__; // dummy to suppress unused var warning

341:

342: // read-transform, write parameters

343: double mu = in__.scalar_constrain();

344: vars__.push_back(mu);

345:

346: double tau = in__.scalar_lb_constrain(0);

347: vars__.push_back(tau);

348:

349: Eigen::Matrix<double, Eigen::Dynamic, 1> eta = in__.vector_constrain(J);

350: size_t eta_j_1_max__ = J;

351: for (size_t j_1__ = 0; j_1__ < eta_j_1_max__; ++j_1__) {

352: vars__.push_back(eta(j_1__));

353: }

354:

355: double lp__ = 0.0;

356: (void) lp__; // dummy to suppress unused var warning

357: stan::math::accumulator lp_accum__;

358:

359: local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN());

360: (void) DUMMY_VAR__; // suppress unused var warning

361:

362: if (!include_tparams__ && !include_gqs__) return;

363:

364: try {

365: // declare and define transformed parameters

366: current_statement_begin__ = 13;

367: validate_non_negative_index(“theta”, “J”, J);

368: Eigen::Matrix<double, Eigen::Dynamic, 1> theta(J);

369: stan::math::initialize(theta, DUMMY_VAR__);

370: stan::math::fill(theta, DUMMY_VAR__);

371: stan::math::assign(theta,add(mu, multiply(tau, eta)));

372:

373: if (!include_gqs__ && !include_tparams__) return;

374: // validate transformed parameters

375: const char* function__ = “validate transformed params”;

376: (void) function__; // dummy to suppress unused var warning

377:

378: // write transformed parameters

379: if (include_tparams__) {

380: size_t theta_j_1_max__ = J;

381: for (size_t j_1__ = 0; j_1__ < theta_j_1_max__; ++j_1__) {

382: vars__.push_back(theta(j_1__));

383: }

384: }

385: if (!include_gqs__) return;

386: } catch (const std::exception& e) {

387: stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__());

388: // Next line prevents compiler griping about no return

389: throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***");

390: }

391: }

392:

393: template

394: void write_array(RNG& base_rng,

395: Eigen::Matrix<double,Eigen::Dynamic,1>& params_r,

396: Eigen::Matrix<double,Eigen::Dynamic,1>& vars,

397: bool include_tparams = true,

398: bool include_gqs = true,

399: std::ostream* pstream = 0) const {

400: std::vector params_r_vec(params_r.size());

401: for (int i = 0; i < params_r.size(); ++i)

402: params_r_vec[i] = params_r(i);

403: std::vector vars_vec;

404: std::vector params_i_vec;

405: write_array(base_rng, params_r_vec, params_i_vec, vars_vec, include_tparams, include_gqs, pstream);

406: vars.resize(vars_vec.size());

407: for (int i = 0; i < vars.size(); ++i)

408: vars(i) = vars_vec[i];

409: }

410:

411: std::string model_name() const {

412: return “model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6”;

413: }

414:

415:

416: void constrained_param_names(std::vectorstd::string& param_names__,

417: bool include_tparams__ = true,

418: bool include_gqs__ = true) const {

419: std::stringstream param_name_stream__;

420: param_name_stream__.str(std::string());

421: param_name_stream__ << “mu”;

422: param_names__.push_back(param_name_stream__.str());

423: param_name_stream__.str(std::string());

424: param_name_stream__ << “tau”;

425: param_names__.push_back(param_name_stream__.str());

426: size_t eta_j_1_max__ = J;

427: for (size_t j_1__ = 0; j_1__ < eta_j_1_max__; ++j_1__) {

428: param_name_stream__.str(std::string());

429: param_name_stream__ << “eta” << ‘.’ << j_1__ + 1;

430: param_names__.push_back(param_name_stream__.str());

431: }

432:

433: if (!include_gqs__ && !include_tparams__) return;

434:

435: if (include_tparams__) {

436: size_t theta_j_1_max__ = J;

437: for (size_t j_1__ = 0; j_1__ < theta_j_1_max__; ++j_1__) {

438: param_name_stream__.str(std::string());

439: param_name_stream__ << “theta” << ‘.’ << j_1__ + 1;

440: param_names__.push_back(param_name_stream__.str());

441: }

442: }

443:

444: if (!include_gqs__) return;

445: }

446:

447:

448: void unconstrained_param_names(std::vectorstd::string& param_names__,

449: bool include_tparams__ = true,

450: bool include_gqs__ = true) const {

451: std::stringstream param_name_stream__;

452: param_name_stream__.str(std::string());

453: param_name_stream__ << “mu”;

454: param_names__.push_back(param_name_stream__.str());

455: param_name_stream__.str(std::string());

456: param_name_stream__ << “tau”;

457: param_names__.push_back(param_name_stream__.str());

458: size_t eta_j_1_max__ = J;

459: for (size_t j_1__ = 0; j_1__ < eta_j_1_max__; ++j_1__) {

460: param_name_stream__.str(std::string());

461: param_name_stream__ << “eta” << ‘.’ << j_1__ + 1;

462: param_names__.push_back(param_name_stream__.str());

463: }

464:

465: if (!include_gqs__ && !include_tparams__) return;

466:

467: if (include_tparams__) {

468: size_t theta_j_1_max__ = J;

469: for (size_t j_1__ = 0; j_1__ < theta_j_1_max__; ++j_1__) {

470: param_name_stream__.str(std::string());

471: param_name_stream__ << “theta” << ‘.’ << j_1__ + 1;

472: param_names__.push_back(param_name_stream__.str());

473: }

474: }

475:

476: if (!include_gqs__) return;

477: }

478:

479: }; // model

480:

481: } // namespace

482:

483: typedef model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6_namespace::model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6 stan_model;

484:

485: #ifndef USING_R

486:

487: stan::model::model_base& new_model(

488: stan::io::var_context& data_context,

489: unsigned int seed,

490: std::ostream* msg_stream) {

491: stan_model* m = new stan_model(data_context, seed, msg_stream);

492: return *m;

493: }

494:

495: #endif

496:

497:

498:

499: #include <rstan_next/stan_fit.hpp>

500:

501: struct stan_model_holder {

502: stan_model_holder(rstan::io::rlist_ref_var_context rcontext,

503: unsigned int random_seed)

504: : rcontext_(rcontext), random_seed_(random_seed)

505: {

506: }

507:

508: //stan::math::ChainableStack ad_stack;

509: rstan::io::rlist_ref_var_context rcontext_;

510: unsigned int random_seed_;

511: };

512:

513: Rcpp::XPtrstan::model::model_base model_ptr(stan_model_holder* smh) {

514: Rcpp::XPtrstan::model::model_base model_instance(new stan_model(smh->rcontext_, smh->random_seed_), true);

515: return model_instance;

516: }

517:

518: Rcpp::XPtrrstan::stan_fit_base fit_ptr(stan_model_holder* smh) {

519: return Rcpp::XPtrrstan::stan_fit_base(new rstan::stan_fit(model_ptr(smh), smh->random_seed_), true);

520: }

521:

522: std::string model_name(stan_model_holder* smh) {

523: return model_ptr(smh).get()->model_name();

524: }

525:

526: RCPP_MODULE(stan_fit4model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6_mod){

527: Rcpp::class_<stan_model_holder>(“stan_fit4model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6”)

528: .constructor<rstan::io::rlist_ref_var_context, unsigned int>()

529: .method(“model_ptr”, &model_ptr)

530: .method(“fit_ptr”, &fit_ptr)

531: .method(“model_name”, &model_name)

532: ;

533: }

534:

535:

536: // declarations

537: extern “C” {

538: SEXP file19a02b6e78fe( ) ;

539: }

540:

541: // definition

542:

543: SEXP file19a02b6e78fe( ){

544: return Rcpp::wrap(“1f2a554aa3b5655c1d7823c366b9bef6”);

545: }

546:

547:

Error in compileCode(f, code, language = language, verbose = verbose) :

Compilation ERROR, function(s)/method(s) not created! g++.exe: error: C:/Program: No such file or directory

g++.exe: error: Files/R/R-4.0.2/library/rstan/lib/x64/libStanServices.a: No such file or directory

In addition: Warning message:

In file.remove(c(unprocessed, processed)) :

cannot remove file ‘C:\Users\johnson.rd.1\AppData\Local\Temp\2\RtmpC0RewG\file19a07a592db9.stan’, reason ‘No such file or directory’

image001.png

I have been running with verbose = TRUE, but a “new user” I’m seemingly running into the max 5 posts limit when trying to post the 500+ lines output of the stan(eightscools) output…

It’s okay. There is enough information for me to fix it.

1 Like

Was this issue fixed? I’m brand new with rstan and I’m having this same problem with my install (error with space in “Program FIles” in the include of Eigen.hpp) . Also brand new here in the forums, and as far as I can tell this trail went cold 7 days ago?

Oh, the trail is still hot. It’s just on

Ben do we need to wrap everywhere rstan uses file paths with file.path()?

Ideally

Alright I’ll try to take a look today

We would have probably already tripped over anything that wasn’t in the makevars PR. Should we also avoid -mtune=native?

Are people reporting errors on windows with -mtune=native as well? @paul.buerkner you didn’t happen to try -mtune=native without the additional -m* stuff did you?

Thank you very much! I saw that message above and edited the Makevars.win file, but I overlooked the link, and therefore missed the next step.

Appears to be working for me now.

The download in the other thread only works for me with just -mtune=native. I dropped the other things. Specifically a generate quantities model didn’t work.

Still works on Windows 10, R 4 with makevars.win set to:

CXX14FLAGS=-O3 -mtune=native
CXX11FLAGS=-O3 -mtune=native
2 Likes

My makevars.win file is this

CXX14FLAGS += -mtune=native -Wno-ignored-attributes -Wno-deprecated-declarations

CXX14FLAGS=-O3 -mtune=native

CXX11FLAGS=-O3 -mtune=native

CXX14FLAGS=-O3 -mtune=native

CXX11FLAGS=-O3 -mtune=native

The error I get is this

ode, language = language, verbose = verbose) :

Compilation ERROR, function(s)/method(s) not created! g++.exe: error: C:/Program: No such file or directory

g++.exe: error: Files/R/R-4.0.2/library/rstan/lib/x64/libStanServices.a: No such file or directory

In addition: Warning message:

In file.remove(c(unprocessed, processed)) :

cannot remove file ‘C:\Users\johnson.rd.1\AppData\Local\Temp\2\RtmpopW60L\file230072f67459.stan’, reason ‘No such file or directory’

Error in sink(type = “output”) : invalid connection

image001.png

I am pretty sure that space issue with the path to libStanServices.a has been fixed for a while on

CXX14FLAGS += -mtune=native -Wno-ignored-attributes -Wno-deprecated-declarations

CXX14FLAGS=-O3 -mtune=native

CXX11FLAGS=-O3 -mtune=native

CXX14FLAGS=-O3 -mtune=native -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2

CXX11FLAGS=-O3 -mtune=native

Still getting this error. Nothing I have tried seems to work

Error in compileCode(f, code, language = language, verbose = verbose) :

Compilation ERROR, function(s)/method(s) not created! g++.exe: error: C:/Program: No such file or directory

g++.exe: error: Files/R/R-4.0.2/library/rstan/lib/x64/libStanServices.a: No such file or directory

image001.png