Problem Installing Garfield

Im getting the following error when installing Garfield, im kind of a newbie when using Linux and I have tryed fixing this many times. Im trying to install Garfield on my Ubuntu22.04 LTS. I have installed the precompiled version of ROOT6.26/02 and Geant4 10.7.3, which I compiled myself. Both are working fine, but when I try to Make garfield, the following errors happen: Can someone maybe help me?

[ 90%] Building CXX object Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/exampleGarfield.cc.o
In file included from /home/lsd/root/include/RtypesCore.h:23,
from /home/lsd/root/include/Rtypes.h:23,
from /home/lsd/root/include/TObject.h:17,
from /home/lsd/root/include/TNamed.h:25,
from /home/lsd/root/include/TRandom.h:25,
from /home/lsd/root/include/TRandom3.h:25,
from /home/lsd/garfieldpp/Include/Garfield/RandomEngineRoot.hh:4,
from /home/lsd/garfieldpp/Include/Garfield/Random.hh:6,
from /home/lsd/garfieldpp/Examples/Geant4GarfieldInterface/exampleGarfield.cc:46:
/home/lsd/root/include/ROOT/RConfig.hxx:48:4: error: #error “ROOT requires support for C++14 or higher.”
48 | # error “ROOT requires support for C++14 or higher.”
| ^~~~~
/home/lsd/root/include/ROOT/RConfig.hxx:50:5: error: #error “Pass -std=c++14 as compiler argument.”
50 | # error “Pass -std=c++14 as compiler argument.”
| ^~~~~
In file included from /home/lsd/root/include/TString.h:29,
from /home/lsd/root/include/TNamed.h:26,
from /home/lsd/root/include/TRandom.h:25,
from /home/lsd/root/include/TRandom3.h:25,
from /home/lsd/garfieldpp/Include/Garfield/RandomEngineRoot.hh:4,
from /home/lsd/garfieldpp/Include/Garfield/Random.hh:6,
from /home/lsd/garfieldpp/Examples/Geant4GarfieldInterface/exampleGarfield.cc:46:
/home/lsd/root/include/ROOT/RStringView.hxx:90:17: error: expected type-specifier
90 | operator std::string_view() const { return std::string_view(fData,fLength); }
| ^~~
In file included from /home/lsd/root/include/TString.h:30,
from /home/lsd/root/include/TNamed.h:26,
from /home/lsd/root/include/TRandom.h:25,
from /home/lsd/root/include/TRandom3.h:25,
from /home/lsd/garfieldpp/Include/Garfield/RandomEngineRoot.hh:4,
from /home/lsd/garfieldpp/Include/Garfield/Random.hh:6,
from /home/lsd/garfieldpp/Examples/Geant4GarfieldInterface/exampleGarfield.cc:46:
/home/lsd/root/include/ROOT/TypeTraits.hxx:49:54: error: ‘decay_t’ is not a member of ‘std’; did you mean ‘decay’?
49 | using arg_types = ROOT::TypeTraits::TypeList<std::decay_t…>;
| ^~~~~~~
| decay
/home/lsd/root/include/ROOT/TypeTraits.hxx:49:54: error: ‘decay_t’ is not a member of ‘std’; did you mean ‘decay’?
49 | using arg_types = ROOT::TypeTraits::TypeList<std::decay_t…>;
| ^~~~~~~
| decay
/home/lsd/root/include/ROOT/TypeTraits.hxx:49:66: error: template argument 1 is invalid
49 | using arg_types = ROOT::TypeTraits::TypeList<std::decay_t…>;
| ^
/home/lsd/root/include/ROOT/TypeTraits.hxx:57:54: error: ‘decay_t’ is not a member of ‘std’; did you mean ‘decay’?
57 | using arg_types = ROOT::TypeTraits::TypeList<std::decay_t…>;
| ^~~~~~~
| decay
/home/lsd/root/include/ROOT/TypeTraits.hxx:57:54: error: ‘decay_t’ is not a member of ‘std’; did you mean ‘decay’?
57 | using arg_types = ROOT::TypeTraits::TypeList<std::decay_t…>;
| ^~~~~~~
| decay
/home/lsd/root/include/ROOT/TypeTraits.hxx:57:66: error: template argument 1 is invalid
57 | using arg_types = ROOT::TypeTraits::TypeList<std::decay_t…>;
| ^
/home/lsd/root/include/ROOT/TypeTraits.hxx:65:54: error: ‘decay_t’ is not a member of ‘std’; did you mean ‘decay’?
65 | using arg_types = ROOT::TypeTraits::TypeList<std::decay_t…>;
| ^~~~~~~
| decay
/home/lsd/root/include/ROOT/TypeTraits.hxx:65:54: error: ‘decay_t’ is not a member of ‘std’; did you mean ‘decay’?
65 | using arg_types = ROOT::TypeTraits::TypeList<std::decay_t…>;
| ^~~~~~~
| decay
/home/lsd/root/include/ROOT/TypeTraits.hxx:65:66: error: template argument 1 is invalid
65 | using arg_types = ROOT::TypeTraits::TypeList<std::decay_t…>;
| ^
/home/lsd/root/include/ROOT/TypeTraits.hxx:73:54: error: ‘decay_t’ is not a member of ‘std’; did you mean ‘decay’?
73 | using arg_types = ROOT::TypeTraits::TypeList<std::decay_t…>;
| ^~~~~~~
| decay
/home/lsd/root/include/ROOT/TypeTraits.hxx:73:54: error: ‘decay_t’ is not a member of ‘std’; did you mean ‘decay’?
73 | using arg_types = ROOT::TypeTraits::TypeList<std::decay_t…>;
| ^~~~~~~
| decay
/home/lsd/root/include/ROOT/TypeTraits.hxx:73:66: error: template argument 1 is invalid
73 | using arg_types = ROOT::TypeTraits::TypeList<std::decay_t…>;
| ^
In file included from /home/lsd/root/include/TNamed.h:26,
from /home/lsd/root/include/TRandom.h:25,
from /home/lsd/root/include/TRandom3.h:25,
from /home/lsd/garfieldpp/Include/Garfield/RandomEngineRoot.hh:4,
from /home/lsd/garfieldpp/Include/Garfield/Random.hh:6,
from /home/lsd/garfieldpp/Examples/Geant4GarfieldInterface/exampleGarfield.cc:46:
/home/lsd/root/include/TString.h:115:13: error: expected type-specifier
115 | operator std::string_view() const { return std::string_view(Data(),fExtent); }
| ^~~
/home/lsd/root/include/TString.h:280:32: error: ‘string_view’ in namespace ‘std’ does not name a type
280 | explicit TString(const std::string_view &sub);
| ^~~~~~~~~~~
/home/lsd/root/include/TString.h:280:27: note: ‘std::string_view’ is only available from C++17 onwards
280 | explicit TString(const std::string_view &sub);
| ^~~
/home/lsd/root/include/TString.h:317:37: error: ‘string_view’ in namespace ‘std’ does not name a type
317 | TString &operator=(const std::string_view &s);
| ^~~~~~~~~~~
/home/lsd/root/include/TString.h:317:32: note: ‘std::string_view’ is only available from C++17 onwards
317 | TString &operator=(const std::string_view &s);
| ^~~
/home/lsd/root/include/TString.h:444:9: error: ‘string_view’ in namespace ‘std’ does not name a type
444 | std::string_view View() const { return std::string_view(GetPointer(),Length()); }
| ^~~~~~~~~~~
/home/lsd/root/include/TString.h:444:4: note: ‘std::string_view’ is only available from C++17 onwards
444 | std::string_view View() const { return std::string_view(GetPointer(),Length()); }
| ^~~
In file included from /home/lsd/root/include/TNamed.h:26,
from /home/lsd/root/include/TRandom.h:25,
from /home/lsd/root/include/TRandom3.h:25,
from /home/lsd/garfieldpp/Include/Garfield/RandomEngineRoot.hh:4,
from /home/lsd/garfieldpp/Include/Garfield/Random.hh:6,
from /home/lsd/garfieldpp/Examples/Geant4GarfieldInterface/exampleGarfield.cc:46:
/home/lsd/root/include/TString.h:839:53: error: ‘string_view’ in namespace ‘std’ does not name a type
839 | inline Bool_t operator==(const char *s1, const std::string_view &s2)
| ^~~~~~~~~~~
/home/lsd/root/include/TString.h:839:48: note: ‘std::string_view’ is only available from C++17 onwards
839 | inline Bool_t operator==(const char s1, const std::string_view &s2)
| ^~~
/home/lsd/root/include/TString.h:839:15: error: ‘Bool_t operator==(const char
, const int&)’ must have an argument of class or enumerated type
839 | inline Bool_t operator==(const char *s1, const std::string_view &s2)
| ^~~~~~~~
/home/lsd/root/include/TString.h:844:37: error: ‘string_view’ in namespace ‘std’ does not name a type
844 | inline Bool_t operator==(const std::string_view &s1, const char *s2)
| ^~~~~~~~~~~
/home/lsd/root/include/TString.h:844:32: note: ‘std::string_view’ is only available from C++17 onwards
844 | inline Bool_t operator==(const std::string_view &s1, const char s2)
| ^~~
/home/lsd/root/include/TString.h:844:15: error: ‘Bool_t operator==(const int&, const char
)’ must have an argument of class or enumerated type
844 | inline Bool_t operator==(const std::string_view &s1, const char *s2)
| ^~~~~~~~
/home/lsd/root/include/TString.h:857:37: error: ‘string_view’ in namespace ‘std’ does not name a type
857 | std::string printValue(const std::string_view* val);
| ^~~~~~~~~~~
/home/lsd/root/include/TString.h:857:32: note: ‘std::string_view’ is only available from C++17 onwards
857 | std::string printValue(const std::string_view* val);
| ^~~
make[2]: *** [Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/build.make:76: Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/exampleGarfield.cc.o] Erro 1
make[1]: *** [CMakeFiles/Makefile2:1259: Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/all] Erro 2
make: *** [Makefile:136: all] Erro 2

Hi,
you need to make sure that ROOT, Geant4 and Garfield++ are compiled using the same C++ standard:

Installation was fixed, thank you very much for your reply!

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