Unable to install 'anomaly' package on linux server

Trying to install the Package anomaly_4.0.0 on Red Hat Enterprise Linux Server release 7.2 (Maipo) using the command:

sudo R CMD INSTALL /home/.../anomaly_4.0.0.tar.gz

(R Version is 3.6.0 (2019-04-26) -- "Planting of a Tree")

I received the following error message: C++14 standard requested but CXX14 is not defined

After a little research I tried the solution provided here:

After creating the Makevars file as described I run into the following error:

marshalling.cpp:192:90: Fehler: Parameter als »auto« deklariert

       transform(cpts.begin(),cpts.end(),xstar.begin(),marshalled_result.begin(),[](auto& cpt,auto& x)

                                                                                                                                  ^

marshalling.cpp:192:100: Fehler: Parameter als »auto« deklariert

       transform(cpts.begin(),cpts.end(),xstar.begin(),marshalled_result.begin(),[](auto& cpt,auto& x)

                                                                                                                                                     ^

marshalling.cpp: In Lambda-Funktion:

marshalling.cpp:195:36: Fehler: »cpt« wurde in diesem Gültigkeitsbereich nicht definiert

     entry[0] = (double)std::get<0>(cpt);

                                                     ^     

marshalling.cpp:197:16: Fehler: »x« wurde in diesem Gültigkeitsbereich nicht definiert

     entry[2] = x;

                     ^

I can’t find a solution to solve this error. Did anyone knows how to crack this? I am grateful for any advice.

There are a couple of proposed Makevars files in that github thread--could you post the content of yours?

I looked into a similar issue with another package recently. I think the default C++ compiler on RHEL 7 (GCC 4.8.5) is just too old to build the anomaly package. GCC 4.8.5 does have partial support for C++14 using the -std=c++1y flag (as mentioned in that rstan GitHub issue), but it's still not complete enough for anomaly.

To work around this, you could install the Red Hat Developer Toolset on your system to get a newer compiler: https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/

Or install the binary package for anomaly from the RStudio Public Package Manager server: https://packagemanager.rstudio.com/client/#/repos/2/overview

> options(repos = "https://packagemanager.rstudio.com/cran/__linux__/centos7/latest")
> install.packages("anomaly")

...

* installing *binary* package ‘anomaly’ ...
* DONE (anomaly)
Making 'packages.html' ... done

These binaries are precompiled with the Red Hat Developer Toolset, and should be compatible with a default RHEL 7 system.

If you go with the Red Hat Developer Toolset, there are a few more details in this thread, like how to activate it or how to install it on AWS: Reinstalling odbc on R 4.0 on Linux RHEL 7.

If you go with the RStudio Package Manager binaries, you may also need additional configuration steps if you've installed R from EPEL: https://docs.rstudio.com/rspm/admin/serving-binaries/#binaries-r-configuration-linux

1 Like

Hey, here You have it:

CXX14 = g++ -std=c++1y -Wno-unused-variable -Wno-unused-function -fPIC

CXX14FLAGS=-O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function -Wno-macro-redefined
CXX14=g++ -std=c++1y -fPIC