Problem in installation

I have downloaded a garfield-master version ,and then cmake successfully. But when i use ‘make -j8’ ,it feedback error as follow

Then i skip this step ,however i couldn’t find install folder in next step. How could i deal with these problem

I am very appreciated if you could give me some advices.

I’m not sure because I can’t read the error message, but the reason could be that CMake found a Geant4 installation without the “advanced option” to include GDML. You could either

  • update your Geant4 installation to include GDML, or
  • if you don’t plan to use the Garfield++/Geant4 interface, re-run CMake with the option
    -DWITH_EXAMPLES=OFF

Maybe @caiazza can also help…

If make didn’t complete is normal that you didn’t find the install folder, as that will be only created and filled in the last stage of the build process.
Unfortunately without the full log of the build process and the state of the CMake cache is difficult to understand what is exactly going on.
Could you please write the console output of the make command to a txt file that you can attach to this request?

The line complaining about the “std::string_view” being available only “from C++17 onwards” suggests that there is a mismatch in the C++ language standard used by different libraries (i.e. Geant4 and / or Garfield++ and / or ROOT).

I installed geant4 following the instructor on the internet, and i didn’t remember i installed GDML…

Actually, i don’t konw what is gdml, is that a library of geant4?

I researched on geant4 directory and then found a folder called “gdml” under the geant4/source/persistency. It that mean i already have gdml?

Sorry, i am a noob in linux :dizzy_face:, and thank you for your precious time again.

I have installed gcc 9.3.0, it is theoretical support c++17…I am not sure whether the problem is form here.

I think posting a entire code may help to resolve this problem effectively, here is the code.
lyp@lyp-System-Product-Name:~/garfield++/garfieldpp-4.0/build$ make -j8
[ 1%] Built target magboltz
[ 66%] Built target Garfield
[ 69%] Built target generate
[ 69%] Built target printTable
[ 69%] Built target merge
[ 70%] Built target gem
[ 71%] Built target penning
[ 72%] Built target read
[ 73%] Built target mdt
[ 74%] Built target mdt_mt
[ 76%] Built target polar
[ 76%] Built target gallery
[ 77%] Built target strip
[ 78%] Built target dipole
[ 80%] Built target fieldlines
[ 80%] Built target integrate
[ 81%] Built target isochrons
[ 82%] Built target wedge
[ 83%] Built target savefield
[ 85%] Built target trim
[ 85%] Built target plotdedx
[ 86%] Built target edep
[ 88%] Built target rangeSi
[ 88%] Built target qdepSi
[ 89%] Built target plotfield
[ 90%] Built target fe55
[ 91%] Built target srim
[ 91%] Built target parallelPlates
[ 92%] Built target MWPCbyneBEM
[ 92%] Built target parallelPlatesWeightingField
[ 93%] Built target crossingWires
[ 93%] Built target BiconicalGemByneBEM
[ 94%] Built target RPCbyneBEM
[ 95%] Building CXX object Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/exampleGarfield.cc.o
[ 96%] Building CXX object Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/src/GarfieldG4FastSimulationModel.cc.o
[ 96%] Building CXX object Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/src/GarfieldMessenger.cc.o
[ 96%] Building CXX object Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/src/GarfieldPhysics.cc.o
[ 97%] Building CXX object Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/src/GarfieldPrimaryGeneratorAction.cc.o
[ 97%] Building CXX object Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/src/GarfieldPhysicsList.cc.o
[ 97%] Building CXX object Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/src/GarfieldRunAction.cc.o
[ 98%] Building CXX object Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/src/GarfieldSteppingAction.cc.o
/home/lyp/garfield++/garfieldpp-4.0/Examples/Geant4GarfieldInterface/src/GarfieldG4FastSimulationModel.cc:36:10: fatal error: G4GDMLParser.hh: 没有那个文件或目录
36 | #include “G4GDMLParser.hh”
| ^~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/build.make:102:Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/src/GarfieldG4FastSimulationModel.cc.o] 错误 1
make[2]: *** 正在等待未完成的任务…
In file included from /home/lyp/garfield++/root/include/TString.h:29,
from /home/lyp/garfield++/root/include/TNamed.h:26,
from /home/lyp/garfield++/root/include/TRandom.h:25,
from /home/lyp/garfield++/root/include/TRandom3.h:25,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/RandomEngineRoot.hh:4,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/Random.hh:6,
from /home/lyp/garfield++/garfieldpp-4.0/Examples/Geant4GarfieldInterface/exampleGarfield.cc:46:
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:32:37: error: ‘experimental’ in namespace ‘std’ does not name a type
32 | using basic_string_view = ::std::experimental::basic_string_view<_CharT,_Traits>;
| ^~~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:35:12: error: ‘basic_string_view’ does not name a type
35 | typedef basic_string_view string_view;
| ^~~~~~~~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:36:12: error: ‘basic_string_view’ does not name a type
36 | typedef basic_string_view<char16_t> u16string_view;
| ^~~~~~~~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:37:12: error: ‘basic_string_view’ does not name a type
37 | typedef basic_string_view<char32_t> u32string_view;
| ^~~~~~~~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:38:12: error: ‘basic_string_view’ does not name a type
38 | typedef basic_string_view<wchar_t> wstring_view;
| ^~~~~~~~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:48:28: error: ‘string_view’ is not a member of ‘std’
48 | inline double stod(std::string_view str, size_t *pos)
| ^~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:48:28: note: ‘std::string_view’ is only available from C++17 onwards
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:48:52: error: expected primary-expression before ‘’ token
48 | inline double stod(std::string_view str, size_t pos)
| ^
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:48:53: error: ‘pos’ was not declared in this scope; did you mean ‘pow’?
48 | inline double stod(std::string_view str, size_t pos)
| ^~~
| pow
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:48:56: error: expression list treated as compound expression in initializer [-fpermissive]
48 | inline double stod(std::string_view str, size_t *pos)
| ^
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:65:56: error: ‘std::string_view’ has not been declared
65 | inline std::string &operator+=(std::string &left, std::string_view right)
| ^~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx: In function ‘std::string& std::__ROOT::operator+=(std::string&, int)’:
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:67:29: error: request for member ‘data’ in ‘right’, which is of non-class type ‘int’
67 | return left.append(right.data(), right.size());
| ^~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:67:43: error: request for member ‘size’ in ‘right’, which is of non-class type ‘int’
67 | return left.append(right.data(), right.size());
| ^~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx: At global scope:
/home/lyp/garfield++/root/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/lyp/garfield++/root/include/TNamed.h:26,
from /home/lyp/garfield++/root/include/TRandom.h:25,
from /home/lyp/garfield++/root/include/TRandom3.h:25,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/RandomEngineRoot.hh:4,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/Random.hh:6,
from /home/lyp/garfield++/garfieldpp-4.0/Examples/Geant4GarfieldInterface/exampleGarfield.cc:46:
/home/lyp/garfield++/root/include/TString.h:115:13: error: expected type-specifier
115 | operator std::string_view() const { return std::string_view(Data(),fExtent); }
| ^~~
/home/lyp/garfield++/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/lyp/garfield++/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/lyp/garfield++/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/lyp/garfield++/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/lyp/garfield++/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/lyp/garfield++/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/lyp/garfield++/root/include/TNamed.h:26,
from /home/lyp/garfield++/root/include/TRandom.h:25,
from /home/lyp/garfield++/root/include/TRandom3.h:25,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/RandomEngineRoot.hh:4,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/Random.hh:6,
from /home/lyp/garfield++/garfieldpp-4.0/Examples/Geant4GarfieldInterface/exampleGarfield.cc:46:
/home/lyp/garfield++/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/lyp/garfield++/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/lyp/garfield++/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/lyp/garfield++/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/lyp/garfield++/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/lyp/garfield++/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/lyp/garfield++/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/lyp/garfield++/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:63:Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/exampleGarfield.cc.o] 错误 1
In file included from /home/lyp/garfield++/root/include/TString.h:29,
from /home/lyp/garfield++/root/include/TCollection.h:29,
from /home/lyp/garfield++/root/include/TSeqCollection.h:25,
from /home/lyp/garfield++/root/include/TList.h:25,
from /home/lyp/garfield++/root/include/TQObject.h:40,
from /home/lyp/garfield++/root/include/TVirtualPad.h:30,
from /home/lyp/garfield++/root/include/TPad.h:15,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/ViewBase.hh:8,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/ViewDrift.hh:12,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/AvalancheMC.hh:10,
from /home/lyp/garfield++/garfieldpp-4.0/Examples/Geant4GarfieldInterface/src/GarfieldPhysics.cc:31:
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:32:37: error: ‘experimental’ in namespace ‘std’ does not name a type
32 | using basic_string_view = ::std::experimental::basic_string_view<_CharT,_Traits>;
| ^~~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:35:12: error: ‘basic_string_view’ does not name a type
35 | typedef basic_string_view string_view;
| ^~~~~~~~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:36:12: error: ‘basic_string_view’ does not name a type
36 | typedef basic_string_view<char16_t> u16string_view;
| ^~~~~~~~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:37:12: error: ‘basic_string_view’ does not name a type
37 | typedef basic_string_view<char32_t> u32string_view;
| ^~~~~~~~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:38:12: error: ‘basic_string_view’ does not name a type
38 | typedef basic_string_view<wchar_t> wstring_view;
| ^~~~~~~~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:48:28: error: ‘string_view’ is not a member of ‘std’
48 | inline double stod(std::string_view str, size_t *pos)
| ^~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:48:28: note: ‘std::string_view’ is only available from C++17 onwards
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:48:52: error: expected primary-expression before ‘
’ token
48 | inline double stod(std::string_view str, size_t pos)
| ^
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:48:53: error: ‘pos’ was not declared in this scope; did you mean ‘pow’?
48 | inline double stod(std::string_view str, size_t pos)
| ^~~
| pow
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:48:56: error: expression list treated as compound expression in initializer [-fpermissive]
48 | inline double stod(std::string_view str, size_t *pos)
| ^
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:65:56: error: ‘std::string_view’ has not been declared
65 | inline std::string &operator+=(std::string &left, std::string_view right)
| ^~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx: In function ‘std::string& std::__ROOT::operator+=(std::string&, int)’:
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:67:29: error: request for member ‘data’ in ‘right’, which is of non-class type ‘int’
67 | return left.append(right.data(), right.size());
| ^~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:67:43: error: request for member ‘size’ in ‘right’, which is of non-class type ‘int’
67 | return left.append(right.data(), right.size());
| ^~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx: At global scope:
/home/lyp/garfield++/root/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/lyp/garfield++/root/include/TCollection.h:29,
from /home/lyp/garfield++/root/include/TSeqCollection.h:25,
from /home/lyp/garfield++/root/include/TList.h:25,
from /home/lyp/garfield++/root/include/TQObject.h:40,
from /home/lyp/garfield++/root/include/TVirtualPad.h:30,
from /home/lyp/garfield++/root/include/TPad.h:15,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/ViewBase.hh:8,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/ViewDrift.hh:12,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/AvalancheMC.hh:10,
from /home/lyp/garfield++/garfieldpp-4.0/Examples/Geant4GarfieldInterface/src/GarfieldPhysics.cc:31:
/home/lyp/garfield++/root/include/TString.h:115:13: error: expected type-specifier
115 | operator std::string_view() const { return std::string_view(Data(),fExtent); }
| ^~~
/home/lyp/garfield++/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/lyp/garfield++/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/lyp/garfield++/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/lyp/garfield++/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/lyp/garfield++/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/lyp/garfield++/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/lyp/garfield++/root/include/TCollection.h:29,
from /home/lyp/garfield++/root/include/TSeqCollection.h:25,
from /home/lyp/garfield++/root/include/TList.h:25,
from /home/lyp/garfield++/root/include/TQObject.h:40,
from /home/lyp/garfield++/root/include/TVirtualPad.h:30,
from /home/lyp/garfield++/root/include/TPad.h:15,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/ViewBase.hh:8,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/ViewDrift.hh:12,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/AvalancheMC.hh:10,
from /home/lyp/garfield++/garfieldpp-4.0/Examples/Geant4GarfieldInterface/src/GarfieldPhysics.cc:31:
/home/lyp/garfield++/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/lyp/garfield++/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/lyp/garfield++/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/lyp/garfield++/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/lyp/garfield++/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/lyp/garfield++/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/lyp/garfield++/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/lyp/garfield++/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:128:Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/src/GarfieldPhysics.cc.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:1174:Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/all] 错误 2
make: *** [Makefile:130:all] 错误 2

I am sorry …the web is allowed to upload a txt file.
Here is the txt file

code.txt (21.0 KB)

You need to make sure that the same “-std=...” C++ compiler flag is used when building all your software.

See, for example, what “-std” your ROOT is using: root-config --cflags

The missing "G4GDMLParser.hh" error suggests that your Geant4 was built without the optional GDML support (e.g., without “-DGEANT4_USE_GDML=ON”).

1 Like

Thank your for your reply.
I have resolved gdml problem. I don’t really understand what the flag “-std” means. I input the command " root -config --cflags " then it displayed a lot of parameters.

So how should i do to use c++17 make the file? Is that c++17 contains the variable “std” and “string_view” ? Could you give me a detailed solution? :sob:
(ps: I directly used apt-get command to install my gcc and cmake app)

One of the first flags in the output of “root-config --cflags” is " -std=..." (and this tells you what C++ language standard your ROOT binaries were built with).

Search for “-std=” in “man g++” for more info.

BTW. You should also be able to learn what C++ language standard your Geant4 binaries were built with: geant4-config --cxxstd

Seem like standard of ROOT is c++14 and standard of geant4 is c++11
How to change to c++17?

You can build a c++14 aware Geant4 using: cmake -DGEANT4_BUILD_CXXSTD=14 ...

If you want to have everything using c++17, you need to build ROOT using “cmake -DCMAKE_CXX_STANDARD=17” and Geant4 using “cmake -DGEANT4_BUILD_CXXSTD=17

Note that, afterward, in any case, you also need to build Garfield++ with the same C++ standard (I guess @hschindl can tell you how).

Hi,
to set the C++ standard to be used for building Garfield++ explicitly, you can use the flag CMAKE_CXX_STANDARD (same as for ROOT).

My problem got solved perfectly! Thank you very much sir!

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