Unsupported C++ standard: 11

Trying to build ROOT 6.26.04 on Fedora 36 using GCC 12.1.1. Getting an error:

mkdir -p root-6.26.04/build_dir
cd root-6.26.04/build_dir ; cmake3 .. -DCMAKE_INSTALL_PREFIX=..  -Dgdml=ON -Droofit=ON -Dmysql=OFF -Ddavix=OFF -Dbuiltin_tbb=ON -DCMAKE_CXX_STANDARD=11
-- The C compiler identification is GNU 12.1.1
-- The CXX compiler identification is GNU 12.1.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/bin/git (found version "2.36.1") 
-- Checking internet connectivity...
-- Yes
-- Looking for Python
-- Found Python3: /usr/bin/python3.10 (found version "3.10.4") found components: Interpreter Development NumPy Development.Module Development.Embed 
-- Could NOT find Python2 (missing: Python2_NumPy_INCLUDE_DIRS NumPy) (found version "2.7.18")
-- Found GCC. Major version 12, minor version 1
CMake Error at cmake/modules/CheckCompiler.cmake:168 (message):
  Unsupported C++ standard: 11
Call Stack (most recent call first):
  CMakeLists.txt:156 (include)


-- Configuring incomplete, errors occurred!
here

Is this a problem with GCC, ROOT, or my command line options?

– Mark


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Starting with ROOT 6.26, you need at least “c++14” (i.e., “-DCMAKE_CXX_STANDARD=14” or newer).

OK. That answers the question. Thank you!

(see also Building ROOT from source - ROOT . You can also omit -DCMAKE_CXX_STANDARD altogether and ROOT will just use the compiler’s default, which for GCC 12 is C++17)