I’m trying to compile ROOT 6_24_06 with c++17
The steps that I follow are:
create “myBuild” directory
enter in myBuild and run cmake -D roofit=ON -D minuit2=ON -Dcxx=17 …
apparently, that’s not enough, and I have to run “ccmake …” to change the compiler from 14 to 17
I change CMAKE_CXX_STANDARD 17
and CXX_STANDARD_STRING 17
run “cmake --build . -j48”
And I get the error that I reported.
By the way, there are other errors in dataframes but I removed them from the compilation hoping that would solve the whole story
[ 94%] Building CXX object graf3d/eve7/CMakeFiles/ROOTEve.dir/src/REveViewer.cxx.o
cd /home/testbeam/root_v6_24_06/myBuild/graf3d/eve7 && /opt/rh/devtoolset-8/root/usr/bin/c++ -DHTTP_WITHOUT_FASTCGI -DNO_SSL_DL -DUSE_WEBSOCKET -I/home/testbeam/root_v6_24_06/graf3d/eve7/inc -I/home/testbeam/root_v6_24_06/core/unix/inc -I/home/testbeam/root_v6_24_06/core/foundation/v7/inc -I/home/testbeam/root_v6_24_06/core/base/v7/inc -I/home/testbeam/root_v6_24_06/core/clingutils/inc -I/home/testbeam/root_v6_24_06/core/textinput/inc -I/home/testbeam/root_v6_24_06/core/thread/inc -I/home/testbeam/root_v6_24_06/core/zip/inc -I/home/testbeam/root_v6_24_06/core/rint/inc -I/home/testbeam/root_v6_24_06/core/clib/inc -I/home/testbeam/root_v6_24_06/core/meta/inc -I/home/testbeam/root_v6_24_06/core/gui/inc -I/home/testbeam/root_v6_24_06/core/cont/inc -I/home/testbeam/root_v6_24_06/core/foundation/inc -I/home/testbeam/root_v6_24_06/core/base/inc -I/home/testbeam/root_v6_24_06/myBuild/ginclude -I/home/testbeam/root_v6_24_06/math/physics/inc -I/home/testbeam/root_v6_24_06/math/matrix/inc -I/home/testbeam/root_v6_24_06/math/mathcore/v7/inc -I/home/testbeam/root_v6_24_06/math/mathcore/inc -I/home/testbeam/root_v6_24_06/core/imt/inc -I/home/testbeam/root_v6_24_06/core/multiproc/inc -I/home/testbeam/root_v6_24_06/tree/treeplayer/inc -I/home/testbeam/root_v6_24_06/hist/hist/inc -I/home/testbeam/root_v6_24_06/tree/tree/inc -I/home/testbeam/root_v6_24_06/graf3d/csg/inc -I/home/testbeam/root_v6_24_06/builtins -I/home/testbeam/root_v6_24_06/graf3d/eve7 -I/home/testbeam/root_v6_24_06/geom/geom/inc -I/home/testbeam/root_v6_24_06/io/io/v7/inc -I/home/testbeam/root_v6_24_06/io/io/inc -I/home/testbeam/root_v6_24_06/net/net/inc -I/home/testbeam/root_v6_24_06/montecarlo/eg/inc -I/home/testbeam/root_v6_24_06/graf2d/gpad/inc -I/home/testbeam/root_v6_24_06/graf2d/graf/inc -I/home/testbeam/root_v6_24_06/graf3d/g3d/inc -I/home/testbeam/root_v6_24_06/gui/webdisplay/inc -I/home/testbeam/root_v6_24_06/net/http/inc -I/home/testbeam/root_v6_24_06/gui/browserv7/inc -I/home/testbeam/root_v6_24_06/gui/browsable/inc -std=c++17 -Wno-implicit-fallthrough -Wno-noexcept-type -pipe -Wshadow -Wall -W -Woverloaded-virtual -fsigned-char -pthread -O3 -DNDEBUG -fPIC -std=c++17 -MD -MT graf3d/eve7/CMakeFiles/ROOTEve.dir/src/REveViewer.cxx.o -MF CMakeFiles/ROOTEve.dir/src/REveViewer.cxx.o.d -o CMakeFiles/ROOTEve.dir/src/REveViewer.cxx.o -c /home/testbeam/root_v6_24_06/graf3d/eve7/src/REveViewer.cxx
/home/testbeam/root_v6_24_06/graf3d/eve7/src/REveCaloData.cxx: In member function ‘virtual Int_t ROOT::Experimental::REveCaloData::WriteCoreJson(nlohmann::json&, Int_t)’:
/home/testbeam/root_v6_24_06/graf3d/eve7/src/REveCaloData.cxx:268:29: error: no match for ‘operator=’ (operand types are ‘nlohmann::basic_json<>::value_type’ {aka ‘nlohmann::basic_json<>’} and ‘TString’)
slice["name"] = s.fName;
^~~~~
In file included from /home/testbeam/root_v6_24_06/graf3d/eve7/inc/ROOT/REveElement.hxx:21,
from /home/testbeam/root_v6_24_06/graf3d/eve7/inc/ROOT/REveCaloData.hxx:16,
from /home/testbeam/root_v6_24_06/graf3d/eve7/src/REveCaloData.cxx:12:
/home/testbeam/root_v6_24_06/builtins/nlohmann/json.hpp:18662:17: note: candidate: ‘nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>& nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::operator=(nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>) [with ObjectType = std::map; ArrayType = std::vector; StringType = std::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; BinaryType = std::vector<unsigned char>]’
basic_json& operator=(basic_json other) noexcept (
^~~~~~~~
/home/testbeam/root_v6_24_06/builtins/nlohmann/json.hpp:18662:17: note: no known conversion for argument 1 from ‘TString’ to ‘nlohmann::basic_json<>’
Hi @mauroroot ,
can you try starting from an empty build directory and only using CMAKE_CXX_STANDARD=17? That’s how we build ROOT for C++17, e.g. cmake -DCMAKE_CXX_STANDARD=17 -Droofit=ON -Dminuit2=ON ..
I started from scratch. I mean, I deleted the root directory and un-tar again the file.
I ran: cmake -D roofit=ON -D minuit2=ON -DCMAKE_CXX_STANDARD=17 ..
Do you have any suggestion on how to proceed?
Many thanks,
Ah, I see you are using devtoolset as compiler toolchain. That’s not supported (see the latest posts on the forum that mention “devtoolset”) , @Axel might be able to give you more details.
To get a ROOT with C++17 support on CentOS7 you can install it with conda, snap and I think also nix, see Installing ROOT - ROOT .
Besides changing distro …you can install a more recent compiler in a conda environment or maybe through EPEL and compile ROOT with that toolchain. I don’t have other ideas but others might.
As a side comment, using recent software (or equivalently recent C++ standards) with CentOS is a pain because CentOS is just not the right distro for it. It sacrifices recency for stability. And CentOS7 is not even the latest version of the distro
Devtools are not supported, but you can get a recent compiler (i.e. with C++17 support) via conda or maybe via EPEL repos (not sure) or via other package managers such as spack or nix. Then you can compile ROOT with that compiler.
I’m not sure what you mean with “supported”. lxplus and lxbatch (the most common computing clusters used at CERN, I think) indeed use CentOS7 but then most software stacks are compiled independently of the CentOS7 system packages and are provided via CVMFS/spack/LCG releases etc.
There is also lxplus8 which uses CentOS8. ROOT supports CentOS7 with its system compiler (supports as in: we test the releases on it, test nightly builds on it and provide packages for it), but the system compiler is a very old gcc version that does not support C++17.
Hi, sorry to bother you again with this.
I have another package that uses ROOT
As I said ROOT is now compiled with c++17 standard
But when I compile this other package I still get this error:
[ 91%] Built target euCliMergerMixedDuplicateMimosaTrigID
make[2]: Leaving directory '/home/testbeam/eudaq-v2/build'
make[2]: Leaving directory '/home/testbeam/eudaq-v2/build'
In file included from /home/testbeam/root_v6_22_08/myBuild/include/TString.h:28,
from /home/testbeam/root_v6_22_08/myBuild/include/TNamed.h:26,
from /home/testbeam/root_v6_22_08/myBuild/include/TAxis.h:24,
from /home/testbeam/root_v6_22_08/myBuild/include/TH1.h:24,
from /home/testbeam/root_v6_22_08/myBuild/include/TH1I.h:24,
from /home/testbeam/eudaq/monitors/onlinemon/include/MonitorPerformanceHistos.hh:11,
from /home/testbeam/eudaq/monitors/onlinemon/src/MonitorPerformanceHistos.cc:8:
/home/testbeam/root_v6_22_08/myBuild/include/ROOT/RStringView.hxx:84:17: error: expected type-specifier
84 | operator std::string_view() const { return std::string_view(fData,fLength); }
| ^~~
In file included from /home/testbeam/root_v6_22_08/myBuild/include/TString.h:28,
from /home/testbeam/root_v6_22_08/myBuild/include/TNamed.h:26,
from /home/testbeam/root_v6_22_08/myBuild/include/TAxis.h:24,
from /home/testbeam/root_v6_22_08/myBuild/include/TH1.h:24,
from /home/testbeam/root_v6_22_08/myBuild/include/TH1F.h:24,
from /home/testbeam/eudaq/monitors/onlinemon/src/../include/EUDAQMonitorHistos.hh:11,
from /home/testbeam/eudaq/monitors/onlinemon/src/EUDAQMonitorHistos.cc:8:
/home/testbeam/root_v6_22_08/myBuild/include/ROOT/RStringView.hxx:84:17: error: expected type-specifier
84 | operator std::string_view() const { return std::string_view(fData,fLength); }
| ^~~
In file included from /home/testbeam/root_v6_22_08/myBuild/include/TString.h:28,
from /home/testbeam/root_v6_22_08/myBuild/include/TNamed.h:26,
from /home/testbeam/root_v6_22_08/myBuild/include/TAxis.h:24,
from /home/testbeam/root_v6_22_08/myBuild/include/TH1.h:24,
from /home/testbeam/root_v6_22_08/myBuild/include/TH2.h:24,
from /home/testbeam/root_v6_22_08/myBuild/include/TH2I.h:24,
from /home/testbeam/eudaq/monitors/onlinemon/include/BaseCollection.hh:11,
from /home/testbeam/eudaq/monitors/onlinemon/src/BaseCollection.cc:8:
/home/testbeam/root_v6_22_08/myBuild/include/ROOT/RStringView.hxx:84:17: error: expected type-specifier
84 | operator std::string_view() const { return std::string_view(fData,fLength); }
| ^~~
The problem seems to be related to ROOT
My guess is that I’m not properly configuring the cmake of the other package?
Is there an option that I need to set in order to do things properly?
Many thanks,
The other package needs to be compiled with C++17 as well, is that the case? You can check the compile options that are used e.g. inspecting the output of make VERBOSE=1.