Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running legacy R 3.5.2 code (ISO C++ 2011 standard support) #1118

Open
maksymiuks opened this issue Mar 4, 2024 · 0 comments
Open

Running legacy R 3.5.2 code (ISO C++ 2011 standard support) #1118

maksymiuks opened this issue Mar 4, 2024 · 0 comments

Comments

@maksymiuks
Copy link

Summary:

Legacy code returns This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options. for rstan v2.18.2 and R 3.5.2

Description:

First of all, I'm sorry for asking a question regarding such an archaic version of the rstan and R. Unfortunately, I have to reproduce a few years old environment in a docker image and I struggle to set rstan to work properly. In the original system, the snippet I'll paste below works just fine, however, when moving the docker, having exactly the same gcc compiler and Makeconf I'm getting the error mentioned above.

Reproducible Steps:

library(rstan)

set.seed(12345)

mu <- 0
tau2 <- 0.5
sigma2 <- 1

n <- 20
theta <- rnorm(n, mu, sqrt(tau2))
y <- rnorm(n, theta, sqrt(sigma2))

### set prior parameters ###
mu0 <- 0
tau20 <- 1
alpha <- 1
beta <- 1

# models
stancodeH0 <- 'data {
    int<lower=1> n; // number of observations
    vector[n] y; // observations
    real<lower=0> alpha;
    real<lower=0> beta;
    real<lower=0> sigma2;
    }
    parameters {
    real<lower=0> tau2; // group-level variance
    vector[n] theta; // participant effects
    }
    model {
    target += inv_gamma_lpdf(tau2 | alpha, beta);
    target += normal_lpdf(theta | 0, sqrt(tau2));
    target += normal_lpdf(y | theta, sqrt(sigma2));
    }
    '

# compile models
tmp <- capture.output(suppressMessages(
  stanmodelH0 <- stan_model(model_code = stancodeH0, model_name="stanmodel")
))

Makeconf used in both environments:

CC = gcc -m64 -std=gnu99
CFLAGS = -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic $(LTO)
CPICFLAGS = -fpic
CPPFLAGS = -I/usr/local/include
CXX = g++ -m64 
CXXCPP = $(CXX) -E
CXXFLAGS = -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic $(LTO)
CXXPICFLAGS = -fpic
CXX98 = g++ -m64
CXX98FLAGS = -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic
CXX98PICFLAGS = -fpic
CXX98STD = -std=gnu++98
CXX11 = g++ -m64
CXX11FLAGS = -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic
CXX11PICFLAGS = -fpic
CXX11STD = -std=gnu++11
CXX14 = g++ -std=c++1y -Wno-unused-variable -Wno-unused-function -fPIC
CXX14FLAGS = 
CXX14PICFLAGS = 
CXX14STD = 

Both systems are running RedHat 7.9

I know it's hard to help with such an old code and without access to the system, however, maybe you have some guesses where I could look for differences and why the same code, in seemingly the same environments, works only in one of them.

@maksymiuks maksymiuks changed the title Running legacy R 3.5.2 code Running legacy R 3.5.2 code (ISO C++ 2011 standard support) Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant