A colleague of mine created the R package LMMELSM, which uses Stan behind the scenes. The package installs easily on my personal computer using install.packages(“LMMELSM”), but when I try to install it on a Unix server I get the following error message:
Error: C++14 standard requested but CXX14 is not defined
Warning message:
In install.packages(“LMMELSM”) :
installation of package ‘LMMELSM’ had non-zero exit status
I believe the issue is with the gcc package available on the server. I don’t have much experience with Stan, so I’m having a hard time troubleshooting this issue on my own. Any suggestions would be much appreciated!
There’s a step describing how to configure the the C++ toolchain for R that involves creating a config file $HOME/.R/Makevars with definitions for CXX14FLAGS and CXX14 – sounds like that may fix the “CXX14 is not defined” symptom.
If you’re not up and running after following the wiki guide, it might be a good idea to share which unix (linux?) distribution you’re using and which version of gcc is installed. On my machine I can see that by running cat /etc/*-release and gcc --version respectively.
I didn’t have any luck following those instructions. Here are the results of that command:
cat (GNU coreutils) 8.22
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html.
After reading some other topics I think the problem may be that the gcc is version 4.8.5, and a newer version is needed. Does anyone know of a work-around without updating gcc?
Ah I see. Okay the output from the first command is:
NAME=“Red Hat Enterprise Linux Server”
VERSION=“7.9 (Maipo)”
ID=“rhel”
ID_LIKE=“fedora”
VARIANT=“Server”
VARIANT_ID=“server”
VERSION_ID=“7.9”
PRETTY_NAME=RHEL
ANSI_COLOR=“0;31”
CPE_NAME=“cpe:/o:redhat:enterprise_linux:7.9:GA:server”
HOME_URL=“https://www.redhat.com/”
BUG_REPORT_URL=“https://bugzilla.redhat.com/”
REDHAT_BUGZILLA_PRODUCT=“Red Hat Enterprise Linux 7”
REDHAT_BUGZILLA_PRODUCT_VERSION=7.9
REDHAT_SUPPORT_PRODUCT=“Red Hat Enterprise Linux”
REDHAT_SUPPORT_PRODUCT_VERSION=“7.9”
Red Hat Enterprise Linux Server release 7.9 (Maipo)
Red Hat Enterprise Linux Server release 7.9 (Maipo)
To fix the CXX14 error you need to add an entry to your Makevars file with:
CXX14 = g++ -std=c++1y
However the minimum supported GCC version with Stan is 4.9.3, since we rely on a number of C++14 features which weren’t implemented in the lower versions
Thank you for your response! If the manager of the server is unable to update to GCC version 4.9.3, do you know of any work-arounds? I need to be able to fit models in parallel or my simulation will take too long and won’t be worth doing.
No there aren’t any workarounds, as it’s a fundamental requirement. The only alternative would be to use a version of Stan prior to the addition of this requirement (would be ~ 2.17 I think).