Build error: unrecognized command line option

I am trying to build the master from source but the following error occurs. I used these options CMAKE_CXX_STANDARD 17

c++: error: unrecognized command line option ‘-std=OFF’
gmake[2]: *** [interpreter/llvm/src/lib/Demangle/CMakeFiles/LLVMDemangle.dir/Demangle.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....

Could you please take a look? Thanks.

Please read tips for efficient and successful posting and posting code

ROOT Version: 6.27/01
Platform: CentOS7.9
Compiler: gcc9.3.0

It should be: cmake -DCMAKE_CXX_STANDARD=17 ...

The -std=OFF appears in this file interpreter/llvm/src/lib/Support/CMakeFiles/LLVMSupport.dir/flags.make

CXX_FLAGS =  -std=c++17 -Wno-implicit-fallthrough -Wno-noexcept-type -pipe  -Wshadow -Wall -W -Woverloaded-virtual -fsigned-char -pthread -fno-semantic-interposition  -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=OFF -w -ffunction-sections -fdata-sections -O3 -DNDEBUG -fvisibility=hidden -fvisibility-inlines-hidden -std=c++17

What was the full “cmake” line that you used to configure it?

I used ccmake ../source/root and only modified CMAKE_CXX_STANDARD and CXX_STANDARD_STRING from 14 to 17, and then pressed c to configure and g to generate CMakeLists. After this, I used cmake --build . --clean-first -- install -j12 to build and install.

You seem to be using “CentOS 7”. How do you get “GCC 9.3” (and the new CMake) on it?

Well, usage of the devtoolset” is not supported.
If you have CVMFS, you could try the tools provided by the LCG views environment.

I built the gcc9.3.0 and cmake3.19.2.
I’m a bit confused because ROOT6.26/04 was built successfully in the same way.
I saw this BOOL type in interpreter/CMakeLists.txt


Maybe @Axel could have a look? It could be related to: GCC Cling compile with -std=c++17 still contains -std=c++11

The problem is solved by using


to configure.

If I don’t add -DLLVM_CXX_STD=c++17, this option will be configured to be OFF, leading to this build error.

Also, as can be seen in the ccmake GUI, the LLVM_CXX_STD option can only be either OFF or On. Therefore, I had to explicitly use -DLLVM_CXX_STD=c++17.

I guess, this should be sufficient:
cmake -DCMAKE_CXX_STANDARD=17 ../source/root

I just encountered this error doing an incremental build of master. clearing the build directory and starting a build from scratch “fixed” it.

1 Like

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