Rstan source code errors or compiler configuration error

599 views
Skip to first unread message

Christian Meister

unread,
Sep 4, 2015, 7:11:29 AM9/4/15
to Stan users mailing list
Hi,
I just updated to Rstan 2.7.0-1 on an external machine. Thereupon I wanted to compile my model again - the same model which worked under previous Rstan versions at the same machine. But now I get some errors.
I already reinstalled Rstan, deleted the /.R/Makevars and created a new one, always following the "rstan getting started"-tutorial and tried this several times. Maybe it's trivial, but I don't see the solution and didn't found a similar error here in the group. The model is attached. Hopefully you could help me. Many thanks in advance!

Here's some info from the external machine:
> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=de_DE.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=de_DE.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=de_DE.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rstan_2.7.0-1 inline_0.3.14 Rcpp_0.12.0  

loaded via a namespace (and not attached):
[1] stats4_3.1.2


my gcc version on the external machine:
gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


and the error code:
> source("04_compileModels.R")
Loading required package: Rcpp
Loading required package: inline

Attaching package: ‘inline’

The following object is masked from ‘package:Rcpp’:

    registerPlugin

rstan (Version 2.7.0-1, packaged: 2015-07-17 18:12:01 UTC, GitRev: 05c3d0058b6a)
For execution on a local, multicore CPU with excess RAM we recommend calling
rstan_options(auto_write = TRUE)
options(mc.cores = parallel::detectCores())

TRANSLATING MODEL '03_growthstem' FROM Stan CODE TO C++ CODE NOW.
successful in parsing the Stan model '03_growthstem'.
COMPILING THE C++ CODE FOR MODEL '03_growthstem' NOW.
OS: x86_64, linux-gnu; rstan: 2.7.0.1; Rcpp: 0.12.0; inline: 0.3.14 
 >> setting environment variables: 
PKG_LIBS = 
PKG_CPPFLAGS =   -isystem"/gpfs0/global/local/R/3.1.2-3/lib64/R/library/Rcpp/include/"  -isystem"/gpfs0/global/local/R/3.1.2-3/lib64/R/library/RcppEigen/include/"  -isystem"/gpfs0/global/local/R/3.1.2-3/lib64/R/library/RcppEigen/include/unsupported"  -isystem"/gpfs0/home/nadja/R/x86_64-unknown-linux-gnu-library/3.1/rstan/include/boost_not_in_BH" -isystem"/gpfs0/global/local/R/3.1.2-3/lib64/R/library/BH/include" -isystem"/gpfs0/home/nadja/R/x86_64-unknown-linux-gnu-library/3.1/StanHeaders/include/src/"  -isystem"/gpfs0/home/nadja/R/x86_64-unknown-linux-gnu-library/3.1/StanHeaders/include/"  -I"/gpfs0/home/nadja/R/x86_64-unknown-linux-gnu-library/3.1/rstan/include" -O3 -Wno-unused-function -Wno-uninitialized -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG
 >> 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.7
   7 : 
   8 : #include <stan/model/model_header.hpp>
   9 : 
  10 : namespace modeld2b770d551c_03_growthstem_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 : class modeld2b770d551c_03_growthstem : public prob_grad {
  27 : private:
  28 :     int N_ind;
  29 :     int N_sp;
  30 :     vector<int> species;
  31 :     double f;
  32 :     vector_d shade;
  33 :     vector_d logdbh;
  34 :     vector_d sigma_1;
  35 :     vector_d sigma_2;
  36 :     vector_d datediff;
  37 :     vector_d abundance;
  38 :     vector<double> obs;
  39 : public:
  40 :     modeld2b770d551c_03_growthstem(stan::io::var_context& context__,
  41 :         std::ostream* pstream__ = 0)
  42 :         : prob_grad(0) {
  43 :         current_statement_begin__ = -1;
  44 : 
  45 :         static const char* function__ = "modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem";
  46 :         (void) function__; // dummy call to supress warning
  47 :         size_t pos__;
  48 :         (void) pos__; // dummy call to supress warning
  49 :         std::vector<int> vals_i__;
  50 :         std::vector<double> vals_r__;
  51 :         context__.validate_dims("data initialization", "N_ind", "int", context__.to_vec());
  52 :         N_ind = int(0);
  53 :         vals_i__ = context__.vals_i("N_ind");
  54 :         pos__ = 0;
  55 :         N_ind = vals_i__[pos__++];
  56 :         context__.validate_dims("data initialization", "N_sp", "int", context__.to_vec());
  57 :         N_sp = int(0);
  58 :         vals_i__ = context__.vals_i("N_sp");
  59 :         pos__ = 0;
  60 :         N_sp = vals_i__[pos__++];
  61 :         context__.validate_dims("data initialization", "species", "int", context__.to_vec(N_ind));
  62 :         validate_non_negative_index("species", "N_ind", N_ind);
  63 :         species = std::vector<int>(N_ind,int(0));
  64 :         vals_i__ = context__.vals_i("species");
  65 :         pos__ = 0;
  66 :         size_t species_limit_#include <rstan/rstaninc.hpp>
  67 : /**
  68 :  * Define Rcpp Module to expose stan_fit's functions to R.
  69 :  */
  70 : RCPP_MODULE(stan_fit4modeld2b770d551c_03_growthstem_mod){
  71 :   Rcpp::class_<rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem,
  72 :                boost::random::ecuyer1988> >("stan_fit4modeld2b770d551c_03_growthstem")
  73 :     // .constructor<Rcpp::List>()
  74 :     .constructor<SEXP, SEXP>()
  75 :     // .constructor<SEXP, SEXP>()
  76 :     .method("call_sampler",
  77 :             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::call_sampler)
  78 :     .method("param_names",
  79 :             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::param_names)
  80 :     .method("param_names_oi",
  81 :             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::param_names_oi)
  82 :     .method("param_fnames_oi",
  83 :             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::param_fnames_oi)
  84 :     .method("param_dims",
  85 :             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::param_dims)
  86 :     .method("param_dims_oi",
  87 :             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::param_dims_oi)
  88 :     .method("update_param_oi",
  89 :             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::update_param_oi)
  90 :     .method("param_oi_tidx",
  91 :             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::param_oi_tidx)
  92 :     .method("grad_log_prob",
  93 :             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::grad_log_prob)
  94 :     .method("log_prob",
  95 :             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::log_prob)
  96 :     .method("unconstrain_pars",
  97 :             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::unconstrain_pars)
  98 :     .method("constrain_pars",
  99 :             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::constrain_pars)
 100 :     .method("num_pars_unconstrained",
 101 :             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::num_pars_unconstrained)
 102 :     .method("unconstrained_param_names",
 103 :             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::unconstrained_param_names)
 104 :     .method("constrained_param_names",
 105 :             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::constrained_param_names)
 106 :     ;
 107 : }
 108 : 
 109 : // declarations
 110 : extern "C" {
 111 : SEXP filed2b93ba739( ) ;
 112 : }
 113 : 
 114 : // definition
 115 : 
 116 : SEXP filed2b93ba739(  ){
 117 :  return Rcpp::wrap("03_growthstem");
 118 : }
 119 : 
 120 : 
Compilation argument:
 /usr/local/R/3.1.2-3/lib64/R/bin/R CMD SHLIB filed2b93ba739.cpp 2> filed2b93ba739.cpp.err.txt 
/usr/local/gcc/5.2.0-1/bin/g++ -I/usr/local/R/3.1.2-3/lib64/R/include -DNDEBUG   -isystem"/gpfs0/global/local/R/3.1.2-3/lib64/R/library/Rcpp/include/"  -isystem"/gpfs0/global/local/R/3.1.2-3/lib64/R/library/RcppEigen/include/"  -isystem"/gpfs0/global/local/R/3.1.2-3/lib64/R/library/RcppEigen/include/unsupported"  -isystem"/gpfs0/home/nadja/R/x86_64-unknown-linux-gnu-library/3.1/rstan/include/boost_not_in_BH" -isystem"/gpfs0/global/local/R/3.1.2-3/lib64/R/library/BH/include" -isystem"/gpfs0/home/nadja/R/x86_64-unknown-linux-gnu-library/3.1/StanHeaders/include/src/"  -isystem"/gpfs0/home/nadja/R/x86_64-unknown-linux-gnu-library/3.1/StanHeaders/include/"  -I"/gpfs0/home/nadja/R/x86_64-unknown-linux-gnu-library/3.1/rstan/include" -O3 -Wno-unused-function -Wno-uninitialized -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -I/usr/local/libxrender/0.9.8-2/include -I/usr/local/libxmu/1.1.2-1/include -I/usr/local/libxinerama/1.1.3-1/include -I/usr/local/libxext/1.3.1-1/include -I/usr/local/libxt/1.1.4-1/include -I/usr/local/libx11/1.5.0-1/include -I/usr/local/xextproto/7.2.1-1/include -I/usr/local/inputproto/2.2-1/include -I/usr/local/libxcb/1.9-1/include -I/usr/local/libxdmcp/1.1.1-1/include -I/usr/local/xproto/7.0.23-1/include -I/usr/local/libxau/1.0.7-1/include -I/usr/local/readline/6.3-2/include -I/usr/local/ncurses/5.9-1/include/ncursesw -I/usr/local/ncurses/5.9-1/include -I/usr/local/cairo/1.14.2-1/include -I/usr/local/glib/2.45.4-1/include -I/usr/local/libffi/3.2.1-1/include -I/usr/local/fontconfig/2.11.94-1/include -I/usr/local/expat/2.1.0-4/include -I/usr/local/pixman/0.32.6-1/include -I/usr/local/libxml2/2.9.2-1/include/libxml2 -I/usr/local/libxml2/2.9.2-1/include -I/usr/local/freetype/2.5.5-1/include -I/usr/local/libpng/1.6.16-1/include -I/usr/local/bzip2/1.0.6-3/include -I/usr/local/zlib/1.2.8-4/include    -fpic  -O3 -c filed2b93ba739.cpp -o filed2b93ba739.o
filed2b93ba739.cpp:66:30: error: stray ‘#’ in program
         size_t species_limit_#include <rstan/rstaninc.hpp>
                              ^
filed2b93ba739.cpp:118:1: error: expected ‘}’ at end of input
 }
 ^
filed2b93ba739.cpp: In constructor ‘modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem::modeld2b770d551c_03_growthstem(stan::io::var_context&, std::ostream*)’:
filed2b93ba739.cpp:66:31: error: expected initializer before ‘include’
         size_t species_limit_#include <rstan/rstaninc.hpp>
                               ^
filed2b93ba739.cpp:110:8: error: expected unqualified-id before string constant
 extern "C" {
        ^
filed2b93ba739.cpp:116:1: error: ‘SEXP’ was not declared in this scope
 SEXP filed2b93ba739(  ){
 ^
filed2b93ba739.cpp:118:1: error: expected ‘}’ at end of input
 }
 ^
filed2b93ba739.cpp: At global scope:
filed2b93ba739.cpp:118:1: error: expected unqualified-id at end of input
filed2b93ba739.cpp:118:1: error: expected ‘}’ at end of input
make: *** [filed2b93ba739.o] Error 1

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.7
  7: 
  8: #include <stan/model/model_header.hpp>
  9: 
 10: namespace modeld2b770d551c_03_growthstem_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: class modeld2b770d551c_03_growthstem : public prob_grad {
 27: private:
 28:     int N_ind;
 29:     int N_sp;
 30:     vector<int> species;
 31:     double f;
 32:     vector_d shade;
 33:     vector_d logdbh;
 34:     vector_d sigma_1;
 35:     vector_d sigma_2;
 36:     vector_d datediff;
 37:     vector_d abundance;
 38:     vector<double> obs;
 39: public:
 40:     modeld2b770d551c_03_growthstem(stan::io::var_context& context__,
 41:         std::ostream* pstream__ = 0)
 42:         : prob_grad(0) {
 43:         current_statement_begin__ = -1;
 44: 
 45:         static const char* function__ = "modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem";
 46:         (void) function__; // dummy call to supress warning
 47:         size_t pos__;
 48:         (void) pos__; // dummy call to supress warning
 49:         std::vector<int> vals_i__;
 50:         std::vector<double> vals_r__;
 51:         context__.validate_dims("data initialization", "N_ind", "int", context__.to_vec());
 52:         N_ind = int(0);
 53:         vals_i__ = context__.vals_i("N_ind");
 54:         pos__ = 0;
 55:         N_ind = vals_i__[pos__++];
 56:         context__.validate_dims("data initialization", "N_sp", "int", context__.to_vec());
 57:         N_sp = int(0);
 58:         vals_i__ = context__.vals_i("N_sp");
 59:         pos__ = 0;
 60:         N_sp = vals_i__[pos__++];
 61:         context__.validate_dims("data initialization", "species", "int", context__.to_vec(N_ind));
 62:         validate_non_negative_index("species", "N_ind", N_ind);
 63:         species = std::vector<int>(N_ind,int(0));
 64:         vals_i__ = context__.vals_i("species");
 65:         pos__ = 0;
 66:         size_t species_limit_#include <rstan/rstaninc.hpp>
 67: /**
 68:  * Define Rcpp Module to expose stan_fit's functions to R.
 69:  */
 70: RCPP_MODULE(stan_fit4modeld2b770d551c_03_growthstem_mod){
 71:   Rcpp::class_<rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem,
 72:                boost::random::ecuyer1988> >("stan_fit4modeld2b770d551c_03_growthstem")
 73:     // .constructor<Rcpp::List>()
 74:     .constructor<SEXP, SEXP>()
 75:     // .constructor<SEXP, SEXP>()
 76:     .method("call_sampler",
 77:             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::call_sampler)
 78:     .method("param_names",
 79:             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::param_names)
 80:     .method("param_names_oi",
 81:             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::param_names_oi)
 82:     .method("param_fnames_oi",
 83:             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::param_fnames_oi)
 84:     .method("param_dims",
 85:             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::param_dims)
 86:     .method("param_dims_oi",
 87:             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::param_dims_oi)
 88:     .method("update_param_oi",
 89:             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::update_param_oi)
 90:     .method("param_oi_tidx",
 91:             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::param_oi_tidx)
 92:     .method("grad_log_prob",
 93:             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::grad_log_prob)
 94:     .method("log_prob",
 95:             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::log_prob)
 96:     .method("unconstrain_pars",
 97:             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::unconstrain_pars)
 98:     .method("constrain_pars",
 99:             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::constrain_pars)
100:     .method("num_pars_unconstrained",
101:             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::num_pars_unconstrained)
102:     .method("unconstrained_param_names",
103:             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::unconstrained_param_names)
104:     .method("constrained_param_names",
105:             &rstan::stan_fit<modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem, boost::random::ecuyer1988>::constrained_param_names)
106:     ;
107: }
108: 
109: // declarations
110: extern "C" {
111: SEXP filed2b93ba739( ) ;
112: }
113: 
114: // definition
115: 
116: SEXP filed2b93ba739(  ){
117:  return Rcpp::wrap("03_growthstem");
118: }
119: 
120: 
Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! filed2b93ba739.cpp:66:30: error: stray ‘#’ in program
         size_t species_limit_#include <rstan/rstaninc.hpp>
                              ^
filed2b93ba739.cpp:118:1: error: expected ‘}’ at end of input
 }
 ^
filed2b93ba739.cpp: In constructor ‘modeld2b770d551c_03_growthstem_namespace::modeld2b770d551c_03_growthstem::modeld2b770d551c_03_growthstem(stan::io::var_context&, std::ostream*)’:
filed2b93ba739.cpp:66:31: error: expected initializer before ‘include’
         size_t species_limit_#include <rstan/rstaninc.hpp>
                               ^
filed2b93ba739.cpp:110:8: error: expected unqualified-id before string constant
 extern "C" {
        ^
filed2b93ba739.cpp:116:1: error: ‘SEXP’ was not declared in this scope
 SEXP filed2b93ba739(  ){
 ^
filed2b93ba739.cpp:118:1: error: expected ‘}’ at end of input
 }
 ^
filed2b93ba739.cpp: At global scope:
filed2b93ba739.cpp:118:1: error: expected u
In addition: Warning message:
In set_cppo("fast") :
  'set_cppo' is defunct; manually edit your Makevars file if necessary


03_growthstem.stan

Ben Goodrich

unread,
Sep 4, 2015, 9:14:44 AM9/4/15
to Stan users mailing list
On Friday, September 4, 2015 at 7:11:29 AM UTC-4, Christian Meister wrote:

This is very odd


  65 :         pos__ = 0;
  66 :         size_t species_limit_#include <rstan/rstaninc.hpp>
  67 : /**
  68 :  * Define Rcpp Module to expose stan_fit's functions to R.
  69 :  */

That
#include <rstan/rstaninc.hpp>
/**

 * Define Rcpp Module to expose stan_fit's functions to R.
*/
is supposed to come at the end of the C++ file, but for you it appears right in the middle of a line that corresponds to the data block.

This isn't happening for me, and I've never seen it happen to anyone else.

Does
example(cxxfunction, package = "inline", run.dontrun = TRUE)
work?

Ben

Christian Meister

unread,
Sep 4, 2015, 9:41:18 AM9/4/15
to stan-...@googlegroups.com
It works:

> fx
An object of class "CFunc"
function (x, y) 
.Primitive(".Call")(<pointer: 0x2ab086f1ea70>, x, y)
<environment: 0x5278c40>
Slot "code":
[1] "\n// includes from the plugin\n#include <RcppArmadillo.h>\n#include <Rcpp.h>\n\n\n#ifndef BEGIN_RCPP\n#define BEGIN_RCPP\n#endif\n\n#ifndef END_RCPP\n#define END_RCPP\n#endif\n\nusing namespace Rcpp;\n\n\n// user includes\n\n\n// declarations\nextern \"C\" {\nSEXP file76c933e419c1( SEXP x, SEXP y) ;\n}\n\n// definition\n\nSEXP file76c933e419c1( SEXP x, SEXP y ){\nBEGIN_RCPP\n\n\t\tint dim = as<int>( x ) ;\n\t\tarma::mat z = as<double>(y) * arma::eye<arma::mat>( dim, dim ) ;\n\t\treturn wrap( arma::accu(z) ) ;\n\t\nEND_RCPP\n}\n\n\n"



But the example models from
 model <- stan_demo()
produce the same error (attached).
Furthermore the error doesn't occur on my local machine - but I have to compile and run this model on the external machine.


cxxfunction.txt
stan_demo_1.txt

Ben Goodrich

unread,
Sep 4, 2015, 9:58:51 AM9/4/15
to Stan users mailing list
On Friday, September 4, 2015 at 9:41:18 AM UTC-4, Christian Meister wrote:

Furthermore the error doesn't occur on my local machine - but I have to compile and run this model on the external machine.

My only guess is that the external machine has some combination of US and DE encoding that throws it off.

I would try doing

debug(cxxfunction)

before calling stan() on the external machine and seeing if you can figure out why the lines are not in the proper order.

Ben

Christian Meister

unread,
Sep 8, 2015, 4:27:54 AM9/8/15
to Stan users mailing list
Am Freitag, 4. September 2015 15:58:51 UTC+2 schrieb Ben Goodrich:

My only guess is that the external machine has some combination of US and DE encoding that throws it off.

Ben, you were right. I changed all locale variables to "en_US.UTF-8". Now everything just works fine. Many thanks!
 

Ben Goodrich

unread,
Sep 8, 2015, 8:24:38 AM9/8/15
to Stan users mailing list

OK. I wish that were not necessary, but I'm glad it is working.

Ben

Bob Carpenter

unread,
Sep 8, 2015, 3:16:25 PM9/8/15
to stan-...@googlegroups.com
Yuck. UTF-8 is a unicode character encoding, whereas en_US
is presumably a locale. What does the locale control?

Any idea why de_DE (or whatever German in Germany is called) messes
up?

- Bob
> --
> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages