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