Issue building root

Not sure how to resolve this. Running, from the build directory,

cmake -DCMAKE_CXX_STANDARD=17 -DCMAKE_INSTALL_PREFIX=../root_install ../root_src
cmake --build . -- -j6

I get the error,

[ 75%] Building CXX object bindings/pyroot/cppyy/CPyCppyy/CMakeFiles/cppyy3_10.dir/src/PyStrings.cxx.o
[ 75%] Building CXX object bindings/pyroot/cppyy/CPyCppyy/CMakeFiles/cppyy3_10.dir/src/Pythonize.cxx.o
[ 75%] Building CXX object bindings/pyroot/cppyy/CPyCppyy/CMakeFiles/cppyy3_10.dir/src/TemplateProxy.cxx.o
[ 75%] Generating G__RIO.cxx, ../../lib/RIO.pcm
While building module 'RIO':
In file included from <built-in>:400:
<command line>:1:9: error: macro name must be an identifier
#define -compilerI/usr/include/c++/12.2.0 1
input_line_7:1:9: error: macro name must be an identifier
#ifndef -compilerI/usr/include/c++/12.2.0
[ 75%] Building CXX object bindings/pyroot/cppyy/CPyCppyy/CMakeFiles/cppyy3_10.dir/src/PyException.cxx.o
Error: /home/paul/root/root_build/core/rootcling_stage1/src/rootcling_stage1: compilation failure (/home/paul/root/root_build/lib/libRIOb75cf0b69b_dictUmbrella.h)
make[2]: *** [io/io/CMakeFiles/G__RIO.dir/build.make:144: io/io/G__RIO.cxx] Error 1
make[1]: *** [CMakeFiles/Makefile2:28978: io/io/CMakeFiles/G__RIO.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 75%] Building CXX object bindings/pyroot/cppyy/CPyCppyy/CMakeFiles/cppyy3_10.dir/src/PyResult.cxx.o
[ 75%] Building CXX object bindings/pyroot/cppyy/CPyCppyy/CMakeFiles/cppyy3_10.dir/src/TupleOfInstances.cxx.o
[ 75%] Building CXX object bindings/pyroot/cppyy/CPyCppyy/CMakeFiles/cppyy3_10.dir/src/TypeManip.cxx.o
[ 75%] Building CXX object bindings/pyroot/cppyy/CPyCppyy/CMakeFiles/cppyy3_10.dir/src/Utility.cxx.o
[ 75%] Linking CXX shared library ../../../../lib/
[ 75%] Built target cppyy3_10
make: *** [Makefile:156: all] Error 2

Welcome to the ROOT forum.
May be @bellenot can help with this issue.

I don’t know, try to look on the forum for error: macro name must be an identifier, it look similar to this:

You need to use either a newer version of ROOT (where this is fixed) or an older version nhloman (where the conflicting cmake statement is not yet introduced).