On CentOS 7, the built-in dev toolchain provides only:
$ gcc --version | head -1
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
which only gives us support for C++11 [1]. More and more R packages, and their dependent libraries, rely on C++14 and C++17 language features. However, unless a modern dev toolchain is used to build R from source, then we're stuck with only supporting C++11. To work around this post R installation is rather tedious and error-prone for the end-user (see Appendix of https://ucsf-cbi.github.io/c4/howto/r.html).
On CentOS, never versions are available in SCLs;
$ scl enable devtoolset-7 'gcc --version' | head -1
gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
$ scl enable devtoolset-8 'gcc --version' | head -1
gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)
$ scl enable devtoolset-9 'gcc --version' | head -1
gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)
C++14 and gcc
According to Section 'C++14 Support in GCC' in [1], it looks like:
gcc (>= 5.0.0) is sufficient in order to support C++14
It also says:
GCC has full support for the of the 2014 C++ standard.
This mode is the default in GCC 6.1 up until GCC 10 (including); it can be explicitly selected with the -std=c++14 command-line flag, or -std=gnu++14 to enable GNU extensions as well.
C++17 and gcc
According to Section 'C++17 Support in GCC' in [1], it looks like:
gcc (>= 7.0.0) is sufficient in order to support C++17, ... or gcc (>= 8.0.0)? (there's one case)
It also says:
GCC has almost full support for the previous revision of the C++ standard, which was published in 2017. Some library features are missing or incomplete, as described in the library documentation.
C++17 features are available since GCC 5. This mode is the default in GCC 11; it can be explicitly selected with the -std=c++17 command-line flag, or -std=gnu++17 to enable GNU extensions as well.
Issue
On CentOS 7, the built-in dev toolchain provides only:
which only gives us support for C++11 [1]. More and more R packages, and their dependent libraries, rely on C++14 and C++17 language features. However, unless a modern dev toolchain is used to build R from source, then we're stuck with only supporting C++11. To work around this post R installation is rather tedious and error-prone for the end-user (see Appendix of https://ucsf-cbi.github.io/c4/howto/r.html).
On CentOS, never versions are available in SCLs;
C++14 and gcc
According to Section 'C++14 Support in GCC' in [1], it looks like:
It also says:
-std=c++14
command-line flag, or-std=gnu++14
to enable GNU extensions as well.C++17 and gcc
According to Section 'C++17 Support in GCC' in [1], it looks like:
It also says:
C++17 features are available since GCC 5. This mode is the default in GCC 11; it can be explicitly selected with the -std=c++17 command-line flag, or -std=gnu++17 to enable GNU extensions as well.
References