C++ standards for various versions of ROOT


Please read tips for efficient and successful posting and posting code

ROOT Version: various
Platform: OSX
Compiler: clang


I would like to know what versions of ROOT correspond to the implementation of advanced C++ features.

For example when is the last version of root compatible with the following C++ standards. I added my guesses.

c++98: ??
c++03: 5.32?
c++11: 6.??
c++14: 6.20??
c++17: 6.24.06

I have some code that uses keywords only available in older standards like c++11 and c++14, so I would like to know what is the latest version of ROOT I can use that is completely consistent.
c

The guesses are not correct. Currently ROOT is still compatible with C++11 (or maybe 14?). I think a min version bump is coming, but I don’t think it hit yet.

I think what you are running into is the compiled version. A binary for ROOT is compiled with either 11, 14, or 17. Unless you are compiling yourself (if I understand correctly, you are interested in running in CI, so you want binaries), so what you are interested in is the chosen binary version. Conda has been 17 for a while. I think the main docker image is 14 still.

Ok. Conda is a different story which I will get to in a bit. For now I’m using Homebrew on OSX 10.14.6. And when I use the root-config tool I seem to get a flag that is -std=c++17.

From what you said, it probably means that my brew formula is compiling with c++17 even though it doesn’t have to. So I can either find a new brew formula or compile from source. And I’m assuming you don’t know how to modify the brew formula??

Why would you assume that? I maintain the brew formula, after all. :slight_smile:

brew edit root
# swap 17 for 14 in the recipe
brew install root --build-from-source

And the edit:

- cxx_version = (MacOS.version < :mojave) ? 14 : 17
+ cxx_version = 14
args << "-DCMAKE_CXX_STANDARD=#{cxx_version}"

(PS: make sure you brew uninstall root first)

Also, this is compiling from source, not very different than doing it yourself.

1 Like

Oh, yeah, my standard spiel:

I’d recommend being on at least macOS 10.15, 10.14 is the oldest supported macOS and macOS 12 is coming out soon, so I expect homebrew will drop 10.14 around when 12 lands. They probably can only afford to build the last 3 versions + Apple Silicon, and the next version will add two builds again instead of one (due to Apple Silicon).

Here it is, found it in my mail, probably has a post version somewhere:

For ROOT’s master and its future 6.26, ROOT will soon require C++14, and even C++17 for the “ROOT7” classes. ROOT’s build system will require CMake 3.16.

So that’s the first one to drop C++11. Also, the first ROOT to support C++20 is planned to be 6.28. The problem here is not support, it’s finding a binary that is build targeting an older version, or building it locally.

Hi,
I can confirm that ROOT 6, up to 6.24, requires to be compiled with C++11 or later (C++14 or later for experimental ROOT7 features). The next release, 6.26, will require C++14 or later (C++17 or later for ROOT7 features). Compiling any ROOT version with C++20 might be problematic as of today.

Having said that, as @henryiii points out different ROOT releases of the same ROOT version might have been compiled with different C++ standard (e.g. the conda packages are compiled with C++17 and our binary distributions are compiled with whatever is the default C++ standard for the default system compiler, e.g. C++14 on Ubuntu 20.04).

To reply to this question directly: 6.24 is the last version of ROOT that you can compile with C++11, and you should be able to compile any ROOT 6 version with C++14 (including the upcoming 6.26).

Cheers,
Enrico

I was right: macOS 10.14 support ended a few hours ago when macOS 12 support landed:
https://twitter.com/mikemcquaid/status/1452633902582009857?s=21

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.