Loading required package: StanHeaders Loading required package: ggplot2 rstan (Version 2.19.3, GitRev: 2e1f913d3ca3) For execution on a local, multicore CPU with excess RAM we recommend calling options(mc.cores = parallel::detectCores()). To avoid recompilation of unchanged Stan programs, we recommend calling rstan_options(auto_write = TRUE) Trying to compile a simple C file Running /opt/freeware/lib64/R/bin/R CMD SHLIB foo.c gcc -maix64 -I"/opt/freeware/lib64/R/include" -DNDEBUG -O2 -I/opt/freeware/include -I/usr/include -D_GETDELIM -mminimal-toc -O2 -I/opt/freeware/include -I/usr/include -D_GETDELIM -c foo.c -o foo.o gcc -maix64 -shared -Wl,-bbigtoc,-brtl -Wl,-G -Wl,-bexpall -Wl,-bnoentry -lc -L/opt/freeware/lib64/R/lib -L/opt/freeware/lib64 -L/opt/freeware/lib -L/usr/lib -o foo.so foo.o -lm -L/opt/freeware/lib64/R/lib -lR /opt/freeware/lib64/libintl.a [1] TRUE stn_md> stancode <- 'data {real y_mean;} parameters {real y;} model {y ~ normal(y_mean,1);}' stn_md> mod <- stan_model(model_code = stancode, verbose = TRUE) TRANSLATING MODEL '16a540c6086086816528e4524def24d9' FROM Stan CODE TO C++ CODE NOW. successful in parsing the Stan model '16a540c6086086816528e4524def24d9'. OS: powerpc, aix6.1.9.0; rstan: 2.19.3; Rcpp: 1.0.4.6; inline: 0.3.15 >> setting environment variables: PKG_LIBS = -L'/software/R/site-library/StanHeaders/lib/' -lStanHeaders PKG_CPPFLAGS = -I"/software/R/site-library/Rcpp/include/" -I"/software/R/site-library/RcppEigen/include/" -I"/software/R/site-library/RcppEigen/include/unsupported" -I"/software/R/site-library/BH/include" -I"/software/R/site-library/StanHeaders/include/src/" -I"/software/R/site-library/StanHeaders/include/" -I"/software/R/site-library/rstan/include" -DEIGEN_NO_DEBUG -D_REENTRANT -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -include stan/math/prim/mat/fun/Eigen.hpp >> Program source : 1 : 2 : // includes from the plugin 3 : // [[Rcpp::plugins(cpp14)]] 4 : 5 : // user includes 6 : #define STAN__SERVICES__COMMAND_HPP 7 : #include 8 : #include 9 : // Code generated by Stan version 2.21.0 10 : 11 : #include 12 : 13 : namespace model17901c279fb208b_16a540c6086086816528e4524def24d9_namespace { 14 : 15 : using std::istream; 16 : using std::string; 17 : using std::stringstream; 18 : using std::vector; 19 : using stan::io::dump; 20 : using stan::math::lgamma; 21 : using stan::model::prob_grad; 22 : using namespace stan::math; 23 : 24 : static int current_statement_begin__; 25 : 26 : stan::io::program_reader prog_reader__() { 27 : stan::io::program_reader reader; 28 : reader.add_event(0, 0, "start", "model17901c279fb208b_16a540c6086086816528e4524def24d9"); 29 : reader.add_event(3, 1, "end", "model17901c279fb208b_16a540c6086086816528e4524def24d9"); 30 : return reader; 31 : } 32 : 33 : class model17901c279fb208b_16a540c6086086816528e4524def24d9 34 : : public stan::model::model_base_crtp { 35 : private: 36 : double y_mean; 37 : public: 38 : model17901c279fb208b_16a540c6086086816528e4524def24d9(stan::io::var_context& context__, 39 : std::ostream* pstream__ = 0) 40 : : model_base_crtp(0) { 41 : ctor_body(context__, 0, pstream__); 42 : } 43 : 44 : model17901c279fb208b_16a540c6086086816528e4524def24d9(stan::io::var_context& context__, 45 : unsigned int random_seed__, 46 : std::ostream* pstream__ = 0) 47 : : model_base_crtp(0) { 48 : ctor_body(context__, random_seed__, pstream__); 49 : } 50 : 51 : void ctor_body(stan::io::var_context& context__, 52 : unsigned int random_seed__, 53 : std::ostream* pstream__) { 54 : typedef double local_scalar_t__; 55 : 56 : boost::ecuyer1988 base_rng__ = 57 : stan::services::util::create_rng(random_seed__, 0); 58 : (void) base_rng__; // suppress unused var warning 59 : 60 : current_statement_begin__ = -1; 61 : 62 : static const char* function__ = "model17901c279fb208b_16a540c6086086816528e4524def24d9_namespace::model17901c279fb208b_16a540c6086086816528e4524def24d9"; 63 : (void) function__; // dummy to suppress unused var warning 64 : size_t pos__; 65 : (void) pos__; // dummy to suppress unused var warning 66 : std::vector vals_i__; 67 : std::vector vals_r__; 68 : local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); 69 : (void) DUMMY_VAR__; // suppress unused var warning 70 : 71 : try { 72 : // initialize data block variables from context__ 73 : current_statement_begin__ = 1; 74 : context__.validate_dims("data initialization", "y_mean", "double", context__.to_vec()); 75 : y_mean = double(0); 76 : vals_r__ = context__.vals_r("y_mean"); 77 : pos__ = 0; 78 : y_mean = vals_r__[pos__++]; 79 : 80 : 81 : // initialize transformed data variables 82 : // execute transformed data statements 83 : 84 : // validate transformed data 85 : 86 : // validate, set parameter ranges 87 : num_params_r__ = 0U; 88 : param_ranges_i__.clear(); 89 : current_statement_begin__ = 1; 90 : num_params_r__ += 1; 91 : } catch (const std::exception& e) { 92 : stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__()); 93 : // Next line prevents compiler griping about no return 94 : throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); 95 : } 96 : } 97 : 98 : ~model17901c279fb208b_16a540c6086086816528e4524def24d9() { } 99 : 100 : 101 : void transform_inits(const stan::io::var_context& context__, 102 : std::vector& params_i__, 103 : std::vector& params_r__, 104 : std::ostream* pstream__) const { 105 : typedef double local_scalar_t__; 106 : stan::io::writer writer__(params_r__, params_i__); 107 : size_t pos__; 108 : (void) pos__; // dummy call to supress warning 109 : std::vector vals_r__; 110 : std::vector vals_i__; 111 : 112 : current_statement_begin__ = 1; 113 : if (!(context__.contains_r("y"))) 114 : stan::lang::rethrow_located(std::runtime_error(std::string("Variable y missing")), current_statement_begin__, prog_reader__()); 115 : vals_r__ = context__.vals_r("y"); 116 : pos__ = 0U; 117 : context__.validate_dims("parameter initialization", "y", "double", context__.to_vec()); 118 : double y(0); 119 : y = vals_r__[pos__++]; 120 : try { 121 : writer__.scalar_unconstrain(y); 122 : } catch (const std::exception& e) { 123 : stan::lang::rethrow_located(std::runtime_error(std::string("Error transforming variable y: ") + e.what()), current_statement_begin__, prog_reader__()); 124 : } 125 : 126 : params_r__ = writer__.data_r(); 127 : params_i__ = writer__.data_i(); 128 : } 129 : 130 : void transform_inits(const stan::io::var_context& context, 131 : Eigen::Matrix& params_r, 132 : std::ostream* pstream__) const { 133 : std::vector params_r_vec; 134 : std::vector params_i_vec; 135 : transform_inits(context, params_i_vec, params_r_vec, pstream__); 136 : params_r.resize(params_r_vec.size()); 137 : for (int i = 0; i < params_r.size(); ++i) 138 : params_r(i) = params_r_vec[i]; 139 : } 140 : 141 : 142 : template 143 : T__ log_prob(std::vector& params_r__, 144 : std::vector& params_i__, 145 : std::ostream* pstream__ = 0) const { 146 : 147 : typedef T__ local_scalar_t__; 148 : 149 : local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); 150 : (void) DUMMY_VAR__; // dummy to suppress unused var warning 151 : 152 : T__ lp__(0.0); 153 : stan::math::accumulator lp_accum__; 154 : try { 155 : stan::io::reader in__(params_r__, params_i__); 156 : 157 : // model parameters 158 : current_statement_begin__ = 1; 159 : local_scalar_t__ y; 160 : (void) y; // dummy to suppress unused var warning 161 : if (jacobian__) 162 : y = in__.scalar_constrain(lp__); 163 : else 164 : y = in__.scalar_constrain(); 165 : 166 : // model body 167 : 168 : current_statement_begin__ = 1; 169 : lp_accum__.add(normal_log(y, y_mean, 1)); 170 : 171 : } catch (const std::exception& e) { 172 : stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__()); 173 : // Next line prevents compiler griping about no return 174 : throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); 175 : } 176 : 177 : lp_accum__.add(lp__); 178 : return lp_accum__.sum(); 179 : 180 : } // log_prob() 181 : 182 : template 183 : T_ log_prob(Eigen::Matrix& params_r, 184 : std::ostream* pstream = 0) const { 185 : std::vector vec_params_r; 186 : vec_params_r.reserve(params_r.size()); 187 : for (int i = 0; i < params_r.size(); ++i) 188 : vec_params_r.push_back(params_r(i)); 189 : std::vector vec_params_i; 190 : return log_prob(vec_params_r, vec_params_i, pstream); 191 : } 192 : 193 : 194 : void get_param_names(std::vector& names__) const { 195 : names__.resize(0); 196 : names__.push_back("y"); 197 : } 198 : 199 : 200 : void get_dims(std::vector >& dimss__) const { 201 : dimss__.resize(0); 202 : std::vector dims__; 203 : dims__.resize(0); 204 : dimss__.push_back(dims__); 205 : } 206 : 207 : template 208 : void write_array(RNG& base_rng__, 209 : std::vector& params_r__, 210 : std::vector& params_i__, 211 : std::vector& vars__, 212 : bool include_tparams__ = true, 213 : bool include_gqs__ = true, 214 : std::ostream* pstream__ = 0) const { 215 : typedef double local_scalar_t__; 216 : 217 : vars__.resize(0); 218 : stan::io::reader in__(params_r__, params_i__); 219 : static const char* function__ = "model17901c279fb208b_16a540c6086086816528e4524def24d9_namespace::write_array"; 220 : (void) function__; // dummy to suppress unused var warning 221 : 222 : // read-transform, write parameters 223 : double y = in__.scalar_constrain(); 224 : vars__.push_back(y); 225 : 226 : double lp__ = 0.0; 227 : (void) lp__; // dummy to suppress unused var warning 228 : stan::math::accumulator lp_accum__; 229 : 230 : local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); 231 : (void) DUMMY_VAR__; // suppress unused var warning 232 : 233 : if (!include_tparams__ && !include_gqs__) return; 234 : 235 : try { 236 : if (!include_gqs__ && !include_tparams__) return; 237 : if (!include_gqs__) return; 238 : } catch (const std::exception& e) { 239 : stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__()); 240 : // Next line prevents compiler griping about no return 241 : throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); 242 : } 243 : } 244 : 245 : template 246 : void write_array(RNG& base_rng, 247 : Eigen::Matrix& params_r, 248 : Eigen::Matrix& vars, 249 : bool include_tparams = true, 250 : bool include_gqs = true, 251 : std::ostream* pstream = 0) const { 252 : std::vector params_r_vec(params_r.size()); 253 : for (int i = 0; i < params_r.size(); ++i) 254 : params_r_vec[i] = params_r(i); 255 : std::vector vars_vec; 256 : std::vector params_i_vec; 257 : write_array(base_rng, params_r_vec, params_i_vec, vars_vec, include_tparams, include_gqs, pstream); 258 : vars.resize(vars_vec.size()); 259 : for (int i = 0; i < vars.size(); ++i) 260 : vars(i) = vars_vec[i]; 261 : } 262 : 263 : std::string model_name() const { 264 : return "model17901c279fb208b_16a540c6086086816528e4524def24d9"; 265 : } 266 : 267 : 268 : void constrained_param_names(std::vector& param_names__, 269 : bool include_tparams__ = true, 270 : bool include_gqs__ = true) const { 271 : std::stringstream param_name_stream__; 272 : param_name_stream__.str(std::string()); 273 : param_name_stream__ << "y"; 274 : param_names__.push_back(param_name_stream__.str()); 275 : 276 : if (!include_gqs__ && !include_tparams__) return; 277 : 278 : if (include_tparams__) { 279 : } 280 : 281 : if (!include_gqs__) return; 282 : } 283 : 284 : 285 : void unconstrained_param_names(std::vector& param_names__, 286 : bool include_tparams__ = true, 287 : bool include_gqs__ = true) const { 288 : std::stringstream param_name_stream__; 289 : param_name_stream__.str(std::string()); 290 : param_name_stream__ << "y"; 291 : param_names__.push_back(param_name_stream__.str()); 292 : 293 : if (!include_gqs__ && !include_tparams__) return; 294 : 295 : if (include_tparams__) { 296 : } 297 : 298 : if (!include_gqs__) return; 299 : } 300 : 301 : }; // model 302 : 303 : } // namespace 304 : 305 : typedef model17901c279fb208b_16a540c6086086816528e4524def24d9_namespace::model17901c279fb208b_16a540c6086086816528e4524def24d9 stan_model; 306 : 307 : #ifndef USING_R 308 : 309 : stan::model::model_base& new_model( 310 : stan::io::var_context& data_context, 311 : unsigned int seed, 312 : std::ostream* msg_stream) { 313 : stan_model* m = new stan_model(data_context, seed, msg_stream); 314 : return *m; 315 : } 316 : 317 : #endif 318 : 319 : /** 320 : * Define Rcpp Module to expose stan_fit's functions to R. 321 : */ 322 : RCPP_MODULE(stan_fit4model17901c279fb208b_16a540c6086086816528e4524def24d9_mod){ 323 : Rcpp::class_ >("stan_fit4model17901c279fb208b_16a540c6086086816528e4524def24d9") 325 : // .constructor() 326 : .constructor() 327 : // .constructor() 328 : .method("call_sampler", 329 : &rstan::stan_fit::call_sampler) 330 : .method("param_names", 331 : &rstan::stan_fit::param_names) 332 : .method("param_names_oi", 333 : &rstan::stan_fit::param_names_oi) 334 : .method("param_fnames_oi", 335 : &rstan::stan_fit::param_fnames_oi) 336 : .method("param_dims", 337 : &rstan::stan_fit::param_dims) 338 : .method("param_dims_oi", 339 : &rstan::stan_fit::param_dims_oi) 340 : .method("update_param_oi", 341 : &rstan::stan_fit::update_param_oi) 342 : .method("param_oi_tidx", 343 : &rstan::stan_fit::param_oi_tidx) 344 : .method("grad_log_prob", 345 : &rstan::stan_fit::grad_log_prob) 346 : .method("log_prob", 347 : &rstan::stan_fit::log_prob) 348 : .method("unconstrain_pars", 349 : &rstan::stan_fit::unconstrain_pars) 350 : .method("constrain_pars", 351 : &rstan::stan_fit::constrain_pars) 352 : .method("num_pars_unconstrained", 353 : &rstan::stan_fit::num_pars_unconstrained) 354 : .method("unconstrained_param_names", 355 : &rstan::stan_fit::unconstrained_param_names) 356 : .method("constrained_param_names", 357 : &rstan::stan_fit::constrained_param_names) 358 : .method("standalone_gqs", 359 : &rstan::stan_fit::standalone_gqs) 360 : ; 361 : } 362 : 363 : // declarations 364 : extern "C" { 365 : SEXP file17901c220e202d( ) ; 366 : } 367 : 368 : // definition 369 : 370 : SEXP file17901c220e202d( ){ 371 : return Rcpp::wrap("16a540c6086086816528e4524def24d9"); 372 : } 373 : 374 : Compilation argument: /opt/freeware/lib64/R/bin/R CMD SHLIB file17901c220e202d.cpp 2> file17901c220e202d.cpp.err.txt g++ -maix64 '-std=c++1y' -I"/opt/freeware/lib64/R/include" -DNDEBUG -I"/software/R/site-library/Rcpp/include/" -I"/software/R/site-library/RcppEigen/include/" -I"/software/R/site-library/RcppEigen/include/unsupported" -I"/software/R/site-library/BH/include" -I"/software/R/site-library/StanHeaders/include/src/" -I"/software/R/site-library/StanHeaders/include/" -I"/software/R/site-library/rstan/include" -DEIGEN_NO_DEBUG -D_REENTRANT -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -include stan/math/prim/mat/fun/Eigen.hpp -O2 -I/opt/freeware/include -I/usr/include -D_GETDELIM -include /software/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp -I '/software/R/site-library/StanHeaders/include' -I '/software/R/site-library/RcppEigen/include' -O3 -mcpu=native -mtune=native -fPIC -c file17901c220e202d.cpp -o file17901c220e202d.o g++ -maix64 -std=c++1y -shared -Wl,-bbigtoc,-brtl -Wl,-G -Wl,-bexpall -Wl,-bnoentry -lc -L/opt/freeware/lib64/R/lib -L/opt/freeware/lib64 -L/opt/freeware/lib -L/usr/lib -o file17901c220e202d.so file17901c220e202d.o -L/software/R/site-library/StanHeaders/lib/ -lStanHeaders -lm -L/opt/freeware/lib64/R/lib -lR /opt/freeware/lib64/libintl.a ld: 0711-224 WARNING: Duplicate symbol: .scalbn ld: 0711-224 WARNING: Duplicate symbol: .scalb ld: 0711-224 WARNING: Duplicate symbol: .fsav ld: 0711-224 WARNING: Duplicate symbol: .fres ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. ld: 0711-302 ERROR: Object file17901c220e202d.o, csect <.text> The csect is part of the .text section, and relocation entries from the csect have been written to the .loader section. ld: 0711-302 ERROR: Object file17901c220e202d.o, csect <.double stan::model::log_prob_grad(model17901c279fb208b_16a540c6086086816528e4524def24d9_namespace::model17901c279fb208b_16a540c6086086816528e4524def24d9 const&, std::vector >&, std::vector >&, std::vector >&, std::basic_ostream >*)> The csect is part of the .text section, and relocation entries from the csect have been written to the .loader section. ld: 0711-302 ERROR: Object file17901c220e202d.o, csect <.double stan::model::log_prob_grad(model17901c279fb208b_16a540c6086086816528e4524def24d9_namespace::model17901c279fb208b_16a540c6086086816528e4524def24d9 const&, std::vector >&, std::vector >&, std::vector >&, std::basic_ostream >*)> The csect is part of the .text section, and relocation entries from the csect have been written to the .loader section. ld: 0711-302 ERROR: Object file17901c220e202d.o, csect <.double stan::model::log_prob_propto(model17901c279fb208b_16a540c6086086816528e4524def24d9_namespace::model17901c279fb208b_16a540c6086086816528e4524def24d9 const&, std::vector >&, std::vector >&, std::basic_ostream >*)> The csect is part of the .text section, and relocation entries from the csect have been written to the .loader section. ld: 0711-302 ERROR: Object file17901c220e202d.o, csect <.double stan::model::log_prob_propto(model17901c279fb208b_16a540c6086086816528e4524def24d9_namespace::model17901c279fb208b_16a540c6086086816528e4524def24d9 const&, std::vector >&, std::vector >&, std::basic_ostream >*)> The csect is part of the .text section, and relocation entries from the csect have been written to the .loader section. ld: 0711-302 ERROR: Object file17901c220e202d.o, csect <.stan::math::var::var(double)> The csect is part of the .text section, and relocation entries from the csect have been written to the .loader section. ld: 0711-302 ERROR: Object file17901c220e202d.o, csect <.stan::math::operands_and_partials::build(double)> The csect is part of the .text section, and relocation entries from the csect have been written to the .loader section. ld: 0711-302 ERROR: Object file17901c220e202d.o, csect <.void stan::math::gradient >(stan::model::model_functional const&, Eigen::Matrix const&, double&, Eigen::Matrix&)> The csect is part of the .text section, and relocation entries from the csect have been written to the .loader section. ld: 0711-302 ERROR: Object file17901c220e202d.o, csect <.stan::math::AutodiffStackSingleton::init()> The csect is part of the .text section, and relocation entries from the csect have been written to the .loader section. ld: 0711-302 ERROR: Object file17901c220e202d.o, csect <.stan::math::AutodiffStackSingleton::~AutodiffStackSingleton()> The csect is part of the .text section, and relocation entries from the csect have been written to the .loader section. ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. collect2: error: ld returned 8 exit status make: *** [/opt/freeware/lib64/R/share/make/shlib.mk:6: file17901c220e202d.so] Error 1 Error in dyn.load(libLFile) : unable to load shared object '/tmp/RtmpaR5qea/file17901c220e202d.so': 0509-140 Relocation failed for /tmp/RtmpaR5qea/file17901c220e202d.so because: 0509-141 Relocation entry 2 (at address 1000476C) has an invalid l_rsecnm field. 0509-141 Relocation entry 3 (at address 10004844) has an invalid l_rsecnm field. 0509-141 Relocation entry 4 (at address 10007B24) has an invalid l_rsecnm field. 0509-141 Relocation entry 5 (at address 10007BF0) has an invalid l_rsecnm field. 0509-141 Relocation entry 6 (at address 10007D44) has an invalid l_rsecnm field. 0509-141 Relocation entry 7 (at address 10007D74) has an invalid l_rsecnm field. 0509-021 Additional errors occurred but are not reported. 0509-191 Examine .loader section relocation entries with the 'dump -Rv' command. Calls: example ... cxxfunctionplus -> -> cxxfunction -> dyn.load Execution halted