HenrikBengtsson / CBI-software

A Scientific Software Stack for HPC (CentOS oriented)
https://wynton.ucsf.edu/hpc/software/software-repositories.html
5 stars 2 forks source link

R: Minimal gcc versions in order to support C++14 and C++17? #16

Closed HenrikBengtsson closed 2 years ago

HenrikBengtsson commented 3 years ago

Issue

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:

It also says:

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

  1. 'C++ Standards Support in GCC' https://gcc.gnu.org/projects/cxx-status.html
HenrikBengtsson commented 2 years ago

Decided on SCL devtoolset-8 for R 4.1.*, which seems to work fine.