robjhyndman / forecast

Forecasting Functions for Time Series and Linear Models
http://pkg.robjhyndman.com/forecast
1.1k stars 340 forks source link

Cannot install newest version of forecast under RHEL7 C++11 compiler required #881

Closed MBeuttler closed 2 years ago

MBeuttler commented 3 years ago
  • installing source package ‘forecast’ ... package ‘forecast’ successfully unpacked and MD5 sums checked libs g++ -I"/opt/R/3.5.3/lib64/R/include" -DNDEBUG -I"/opt/R/3.5.3/lib64/R/library/Rcpp/include" -I"/opt/R/3.5.3/lib64/R/library/RcppArmadillo/include" -I/usr/local/include -fpic -g -O2 -c calcBATS.cpp -o calcBATS.o In file included from /opt/R/3.5.3/lib64/R/library/RcppArmadillo/include/armadillo:21:0, from /opt/R/3.5.3/lib64/R/library/RcppArmadillo/include/RcppArmadilloForward.h:49, from /opt/R/3.5.3/lib64/R/library/RcppArmadillo/include/RcppArmadillo.h:31, from calcBATS.h:36, from calcBATS.cpp:1: /opt/R/3.5.3/lib64/R/library/RcppArmadillo/include/armadillo_bits/compiler_check.hpp:50:4: error: #error "*** C++11 compiler required; enable C++11 mode in your compiler, or use an earlier version of Armadillo"

    error "*** C++11 compiler required; enable C++11 mode in your compiler, or use an earlier version of Armadillo"

    ^ In file included from /usr/include/c++/4.8.2/cstdint:35:0, from /opt/R/3.5.3/lib64/R/library/RcppArmadillo/include/armadillo:28, from /opt/R/3.5.3/lib64/R/library/RcppArmadillo/include/RcppArmadilloForward.h:49, from /opt/R/3.5.3/lib64/R/library/RcppArmadillo/include/RcppArmadillo.h:31, from calcBATS.h:36, from calcBATS.cpp:1: /usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error 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.

CXX_STD flag seems missing under src/Makevars: CXX_STD = CXX11

robjhyndman commented 3 years ago

Try updating gcc.

@eddelbuettel Should there be other flags in Makevars?

eddelbuettel commented 3 years ago

The problem here is R 3.5.3 as seen from the log. The current R 4.0.0 defaults to C++11; the soon-to-arrive R 4.1.0 (by mid-April) will default to C++14.

But yes, for older packages we can easily enforce it, and we have done so for a long. Look e.g. at the skeleton Makevars added by the package helper RcppArmadillo.package.skeleton. Here the link lines are equally important so make sure to take lines 11 to 14. And, looking at this, I have to double check if PKG_CXXFLAGS should now be PKG_CXX11FLAGS.... [did check, still ok ;-) , it is the non-package CXXFLAGS that get 11, 14, 17, ... injected ]

robjhyndman commented 3 years ago

Looks like I had that in Makevars.win but not Makevars. Now using your skeleton Makevars instead.