# Errors during Garfield++ installation

**URL:** <https://root-forum.cern.ch/t/errors-during-garfield-installation/62989>\
**Category:** Garfield++\
**Tags:** root\
**Created:** [February 20, 2025, 9:32am UTC](https://root-forum.cern.ch/t/errors-during-garfield-installation/62989 "2025-02-20T09:32:09Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![clouter](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/50afbb/32.png) [@clouter](https://root-forum.cern.ch/u/clouter)\
**Post date:** [February 20, 2025, 9:32am UTC](https://root-forum.cern.ch/t/errors-during-garfield-installation/62989/1 "2025-02-20T09:32:09Z")

</div>

Dear Experts,  
I am new to garfield. When i was installing garfield++, using code

> make -j8

I got errors below

```auto
root@clouter-VMware-Virtual-Platform:/home/mydir/garfield# make -j8
[0%] Built target Degrade
[0%] Built target GarfieldRandom
[2%] Built target Magboltz
[2%] Built target Degrade
[17%] Built target Heed
[43%] Built target Garfield
[44%] Built target ion_signal
[45%] Built target integrate
[46%] Built target mwpc
[47%] Built target gallery
[47%] Built target plot_gas
[48%] Built target fieldlines
[48%] Built target full_tpc_sim
[49%] Built target dipole
[49%] Built target polar
[50%] Built target wedge
[50%] Built target isochrons
[50%] Built target charges
[51%] Built target sag
[51%] Built target strip
[51%] Built target pixels
[52%] Built target plotForces
[53%] Built target stripAnsys121
[53%] Built target mm
[54%] Built target optimise
[55%] Built target strips
[55%] Built target triplegem
[55%] Built target Bichsel
[55%] Built target cst
[55%] Built target gem
[56%] Built target mip
[57%] Built target plotdedx
[58%] Built target analytic
[58%] Built target example
[58%] Built target fast_ion_signal
[59%] Built target mdt
[60%] Built target Electroluminescence_example
[60%] Built target mdt_mt
[60%] Built target avalanche
[61%] Built target userHandle
[62%] Built target pp
[63%] Built target wire2d_example
[64%] Built target merge
[65%] Built target printTable
[66%] Built target generate
[67%] Built target arco2
[67%] Built target distance
[68%] Built target read
[68%] Built target penning
[69%] Built target plotcs
[69%] Built target Gem
[70%] Built target plotvsEN
[71%] Built target plotExtrap
[71%] Built target plotfield
[71%] Built target gem_movie
[71%] Built target savefield
[72%] Built target gem_gpu
[73%] Built target heed_bfield
[75%] Built target bfield
[75%] Built target edep
[75%] Built target qdepSi
[76%] Built target rangeSi
**[76%] Linking CXX executable exampleGeant4Interface**
[77%] Built target fe55
[77%] Built target heed_plotdedx
[78%] Built target RPCbyneBEM
[78%] Built target parallelPlates
[79%] Built target BiconicalGemByneBEM
[80%] Built target crossingWires
[81%] Built target MWPCbyneBEM
[82%] Built target parallelPlatesWeightingField
[83%] Built target gastable
[84%] Built target paschenariso
[84%] Built target Weight
[84%] Built target rpc_sc
[85%] Built target mrpc_sc
[85%] Built target noise
[86%] Built target Signalstest
[86%] Built target planar_movie
[87%] Built target planar
[88%] Built target srim
[88%] Built target trim
[89%] Built target srimbfield
[90%] Built target trimsignal
[91%] Built target pixel
[92%] Built target checkhwf
[93%] Built target diode
[94%] Built target pixel_mt
[95%] Built target Test
[96%] Built target voxel_plotfield
[96%] Built target voxel_savefield
[96%] Built target RandomNumberGenerators
**/usr/bin/ld: CMakeFiles/exampleGeant4Interface.dir/src/GarfieldG4FastSimulationModel.cc.o: warning: relocation against `_ZTIN11xercesc_3_317SAXParseExceptionE' in read-only section `.text.unlikely._ZThn24_N11xercesc_3_311HandlerBase10fatalErrorERKNS_17SAXParseExceptionE[_ZN11xercesc_3_311HandlerBase10fatalErrorERKNS_17SAXParseExceptionE]'**
**/usr/bin/ld: CMakeFiles/exampleGeant4Interface.dir/src/GarfieldG4FastSimulationModel.cc.o: in function `GarfieldG4FastSimulationModel::WriteGeometryToGDML(G4VPhysicalVolume*)':**
**GarfieldG4FastSimulationModel.cc:(.text+0x63d): undefined reference to `G4GDMLParser::G4GDMLParser()'**
**/usr/bin/ld: GarfieldG4FastSimulationModel.cc:(.text+0x785): undefined reference to `G4GDMLWrite::Write(G4String const&, G4LogicalVolume const*, G4String const&, int, bool)'**
**/usr/bin/ld: GarfieldG4FastSimulationModel.cc:(.text+0x7bb): undefined reference to `G4GDMLParser::~G4GDMLParser()'**
**/usr/bin/ld: GarfieldG4FastSimulationModel.cc:(.text+0x81e): undefined reference to `G4GDMLParser::ExportRegions(bool)'**
**/usr/bin/ld: CMakeFiles/exampleGeant4Interface.dir/src/GarfieldG4FastSimulationModel.cc.o: in function `xercesc_3_3::HandlerBase::fatalError(xercesc_3_3::SAXParseException const&)':**
**GarfieldG4FastSimulationModel.cc:(.text.unlikely._ZN11xercesc_3_311HandlerBase10fatalErrorERKNS_17SAXParseExceptionE[_ZN11xercesc_3_311HandlerBase10fatalErrorERKNS_17SAXParseExceptionE]+0x1e): undefined reference to `xercesc_3_3::SAXParseException::SAXParseException(xercesc_3_3::SAXParseException const&)'**
**/usr/bin/ld: GarfieldG4FastSimulationModel.cc:(.text.unlikely._ZN11xercesc_3_311HandlerBase10fatalErrorERKNS_17SAXParseExceptionE[_ZN11xercesc_3_311HandlerBase10fatalErrorERKNS_17SAXParseExceptionE]+0x25): undefined reference to `xercesc_3_3::SAXParseException::~SAXParseException()'**
**/usr/bin/ld: GarfieldG4FastSimulationModel.cc:(.text.unlikely._ZN11xercesc_3_311HandlerBase10fatalErrorERKNS_17SAXParseExceptionE[_ZN11xercesc_3_311HandlerBase10fatalErrorERKNS_17SAXParseExceptionE]+0x2c): undefined reference to `typeinfo for xercesc_3_3::SAXParseException'**
**/usr/bin/ld: CMakeFiles/exampleGeant4Interface.dir/src/GarfieldG4FastSimulationModel.cc.o: in function `xercesc_3_3::DTDEntityDecl::~DTDEntityDecl()':**
**GarfieldG4FastSimulationModel.cc:(.text._ZN11xercesc_3_313DTDEntityDeclD2Ev[_ZN11xercesc_3_313DTDEntityDeclD5Ev]+0xf): undefined reference to `xercesc_3_3::XMLEntityDecl::~XMLEntityDecl()'**
**/usr/bin/ld: CMakeFiles/exampleGeant4Interface.dir/src/GarfieldG4FastSimulationModel.cc.o: in function `xercesc_3_3::DTDEntityDecl::~DTDEntityDecl()':**
**GarfieldG4FastSimulationModel.cc:(.text._ZN11xercesc_3_313DTDEntityDeclD0Ev[_ZN11xercesc_3_313DTDEntityDeclD5Ev]+0x13): undefined reference to `xercesc_3_3::XMLEntityDecl::~XMLEntityDecl()'**
**/usr/bin/ld: GarfieldG4FastSimulationModel.cc:(.text._ZN11xercesc_3_313DTDEntityDeclD0Ev[_ZN11xercesc_3_313DTDEntityDeclD5Ev]+0x1c): undefined reference to `xercesc_3_3::XMemory::operator delete(void*)'**
**/usr/bin/ld: CMakeFiles/exampleGeant4Interface.dir/src/GarfieldG4FastSimulationModel.cc.o: in function `non-virtual thunk to xercesc_3_3::HandlerBase::fatalError(xercesc_3_3::SAXParseException const&)':**
**GarfieldG4FastSimulationModel.cc:(.text.unlikely._ZThn24_N11xercesc_3_311HandlerBase10fatalErrorERKNS_17SAXParseExceptionE[_ZN11xercesc_3_311HandlerBase10fatalErrorERKNS_17SAXParseExceptionE]+0x1e): undefined reference to `xercesc_3_3::SAXParseException::SAXParseException(xercesc_3_3::SAXParseException const&)'**
**/usr/bin/ld: GarfieldG4FastSimulationModel.cc:(.text.unlikely._ZThn24_N11xercesc_3_311HandlerBase10fatalErrorERKNS_17SAXParseExceptionE[_ZN11xercesc_3_311HandlerBase10fatalErrorERKNS_17SAXParseExceptionE]+0x25): undefined reference to `xercesc_3_3::SAXParseException::~SAXParseException()'**
**/usr/bin/ld: GarfieldG4FastSimulationModel.cc:(.text.unlikely._ZThn24_N11xercesc_3_311HandlerBase10fatalErrorERKNS_17SAXParseExceptionE[_ZN11xercesc_3_311HandlerBase10fatalErrorERKNS_17SAXParseExceptionE]+0x2c): undefined reference to `typeinfo for xercesc_3_3::SAXParseException'**
**/usr/bin/ld: CMakeFiles/exampleGeant4Interface.dir/src/GarfieldG4FastSimulationModel.cc.o:(.data.rel.ro._ZTIN11xercesc_3_313DTDEntityDeclE[_ZTIN11xercesc_3_313DTDEntityDeclE]+0x10): undefined reference to `typeinfo for xercesc_3_3::XMLEntityDecl'**
**/usr/bin/ld: CMakeFiles/exampleGeant4Interface.dir/src/GarfieldG4FastSimulationModel.cc.o:(.data.rel.ro._ZTVN11xercesc_3_313XMLAttDefListE[_ZTVN11xercesc_3_313XMLAttDefListE]+0x20): undefined reference to `xercesc_3_3::XMLAttDefList::isSerializable() const'**
**/usr/bin/ld: CMakeFiles/exampleGeant4Interface.dir/src/GarfieldG4FastSimulationModel.cc.o:(.data.rel.ro._ZTVN11xercesc_3_313XMLAttDefListE[_ZTVN11xercesc_3_313XMLAttDefListE]+0x28): undefined reference to `xercesc_3_3::XMLAttDefList::serialize(xercesc_3_3::XSerializeEngine&)'**
**/usr/bin/ld: CMakeFiles/exampleGeant4Interface.dir/src/GarfieldG4FastSimulationModel.cc.o:(.data.rel.ro._ZTVN11xercesc_3_313XMLAttDefListE[_ZTVN11xercesc_3_313XMLAttDefListE]+0x30): undefined reference to `xercesc_3_3::XMLAttDefList::getProtoType() const'**
**/usr/bin/ld: CMakeFiles/exampleGeant4Interface.dir/src/GarfieldG4FastSimulationModel.cc.o:(.data.rel.ro._ZTVN11xercesc_3_313DTDEntityDeclE[_ZTVN11xercesc_3_313DTDEntityDeclE]+0x20): undefined reference to `xercesc_3_3::DTDEntityDecl::isSerializable() const'**
**/usr/bin/ld: CMakeFiles/exampleGeant4Interface.dir/src/GarfieldG4FastSimulationModel.cc.o:(.data.rel.ro._ZTVN11xercesc_3_313DTDEntityDeclE[_ZTVN11xercesc_3_313DTDEntityDeclE]+0x28): undefined reference to `xercesc_3_3::DTDEntityDecl::serialize(xercesc_3_3::XSerializeEngine&)'**
**/usr/bin/ld: CMakeFiles/exampleGeant4Interface.dir/src/GarfieldG4FastSimulationModel.cc.o:(.data.rel.ro._ZTVN11xercesc_3_313DTDEntityDeclE[_ZTVN11xercesc_3_313DTDEntityDeclE]+0x30): undefined reference to `xercesc_3_3::DTDEntityDecl::getProtoType() const'**
 **/usr/bin/ld: warning: creating DT_TEXTREL in a PIE**
 **collect2: error: ld returned 1 exit status**
**make[2]:*** [Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/build.make:298：Examples/Geant4GarfieldInterface/exampleGeant4Interface] Error 1**
**make[1]:*** [CMakeFiles/Makefile2:3218：Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/all] Error 2**
**make:*** [Makefile:146：all] Error 2**

```

Now I’m using root 6.34.02,gcc 14.2.0. Much appreciate if anyone can help.

---

<div class="post-metadata">

**Author:** ![mdessole](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mdessole/32/34021_2.png) [@mdessole](https://root-forum.cern.ch/u/mdessole)\
**Post date:** [February 20, 2025, 9:57am UTC](https://root-forum.cern.ch/t/errors-during-garfield-installation/62989/2 "2025-02-20T09:57:24Z")

</div>

Dear @clouter,

could you please share your cmake configuration? From what I can tell so far, the problem is that cmake is not able to link against Geant4 to build [Geant4GarfieldInterface](https://gitlab.cern.ch/garfield/garfieldpp/-/tree/master/Examples/Geant4GarfieldInterface)

Cheers,  
Monica

---

<div class="post-metadata">

**Author:** ![clouter](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/50afbb/32.png) [@clouter](https://root-forum.cern.ch/u/clouter)\
**Post date:** [February 20, 2025, 11:36am UTC](https://root-forum.cern.ch/t/errors-during-garfield-installation/62989/4 "2025-02-20T11:36:45Z")

</div>

Dear @mdessole,

Sorry about that, i forgot to paste them. Here is what i using cmake’s outputs:

> root@clouter-VMware-Virtual-Platform:/home/clouter# cd $GARFIELD\_HOME  
> root@clouter-VMware-Virtual-Platform:/home/mydir/garfield# cmake -DGeant4\_DIR=/home/clouter/geant4/geant4-v11.3.0-install/lib/cmake/Geant4 -DGeant4\_USE\_GDML=ON $GARFIELD\_HOME  
> – The installation folder is set to its default value /home/mydir/garfield-install  
> – Install path: /home/mydir/garfield-install  
> – If you want to change this path call cmake -DCMAKE\_INSTALL\_PREFIX=my\_install\_path …  
> – Found OpenMP\_CXX: -fopenmp (found version “4.5”)  
> – Found OpenMP\_Fortran: -fopenmp (found version “4.5”)  
> – Found OpenMP: TRUE (found version “4.5”)  
> – Garfield++ examples will be built. In order disable this option use -DWITH\_EXAMPLES=OFF  
> – Found OpenMP\_CXX: -fopenmp (found version “4.5”)  
> – Found OpenMP\_Fortran: -fopenmp (found version “4.5”)  
> – Found OpenMP: TRUE (found version “4.5”)  
> – Configuring done (1.5s)  
> – Generating done (0.9s)  
> – Build files have been written to: /home/mydir/Garfield

PS: _$GARFIELD\_HOME_ is _/home/mydir/Garfield_

---

<div class="post-metadata">

**Author:** ![mdessole](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mdessole/32/34021_2.png) [@mdessole](https://root-forum.cern.ch/u/mdessole)\
**Post date:** [February 20, 2025, 12:21pm UTC](https://root-forum.cern.ch/t/errors-during-garfield-installation/62989/5 "2025-02-20T12:21:38Z")

</div>

you should use a different directory for your build, e.g.

```auto
cd $GARFIELD_HOME
mkdir build
cd build

```

and then launch your cmake command. I recommend to start from a fresh new clone of the garfield source code (some file have been overwritten).

---

<div class="post-metadata">

**Author:** ![mdessole](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mdessole/32/34021_2.png) [@mdessole](https://root-forum.cern.ch/u/mdessole)\
**Post date:** [February 20, 2025, 12:28pm UTC](https://root-forum.cern.ch/t/errors-during-garfield-installation/62989/6 "2025-02-20T12:28:49Z")

</div>

I also recommend to add Geant4 to your path

---

<div class="post-metadata">

**Author:** ![clouter](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/50afbb/32.png) [@clouter](https://root-forum.cern.ch/u/clouter)\
**Post date:** [February 21, 2025, 9:19am UTC](https://root-forum.cern.ch/t/errors-during-garfield-installation/62989/7 "2025-02-21T09:19:30Z")

</div>

Dear @mdessole ,

Sorry about replying late. I tried to start from fresh new clone, geant4 is in my path, and use the different directory for build, but unfortunately it shows the same error. I have no idea how to fix it. Could any of this be due to missing dependency libraries? Or other causes? Much appreciated.

---

<div class="post-metadata">

**Author:** ![mdessole](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mdessole/32/34021_2.png) [@mdessole](https://root-forum.cern.ch/u/mdessole)\
**Post date:** [February 21, 2025, 9:40am UTC](https://root-forum.cern.ch/t/errors-during-garfield-installation/62989/8 "2025-02-21T09:40:39Z")

</div>

Try to add these lines to your `Examples/Geant4GarfieldInterface/CMakeLists.txt` file, say below line 21, and then try to rebuild from scratch:

```auto
message(STATUS "Geant4_USE_FILE: ${Geant4_USE_FILE}")
message(STATUS "Geant4_LIBRARIES: ${Geant4_LIBRARIES}")

```

Wha’t the output of the cmake build?

---

<div class="post-metadata">

**Author:** ![clouter](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/50afbb/32.png) [@clouter](https://root-forum.cern.ch/u/clouter)\
**Post date:** [February 21, 2025, 9:55am UTC](https://root-forum.cern.ch/t/errors-during-garfield-installation/62989/9 "2025-02-21T09:55:39Z")

</div>

Below are outputs. Besides, It shows a new error i had not met before

> root@clouter-VMware-Virtual-Platform:/home/mydir/garfield/build# cmake -DGeant4\_DIR=/home/clouter/geant4/geant4-v11.3.0-build -DGeant4\_USE\_GDML=ON $GARFIELD\_HOME  
> – The installation folder is set to its default value /home/mydir/garfield/install  
> – Install path: /home/mydir/garfield/install  
> – If you want to change this path call cmake -DCMAKE\_INSTALL\_PREFIX=my\_install\_path …  
> – Found OpenMP\_CXX: -fopenmp (found version “4.5”)  
> – Found OpenMP\_Fortran: -fopenmp (found version “4.5”)  
> – Found OpenMP: TRUE (found version “4.5”)  
> – Garfield++ examples will be built. In order disable this option use -DWITH\_EXAMPLES=OFF  
> – Found OpenMP\_CXX: -fopenmp (found version “4.5”)  
> – Found OpenMP\_Fortran: -fopenmp (found version “4.5”)  
> – Found OpenMP: TRUE (found version “4.5”)  
> – Geant4\_USE\_FILE: /home/clouter/geant4/geant4-v11.3.0-build/UseGeant4.cmake  
> – Geant4\_LIBRARIES: Geant4::G4Tree;Geant4::G4FR;Geant4::G4GMocren;Geant4::G4visHepRep;Geant4::G4RayTracer;Geant4::G4VRML;Geant4::G4ToolsSG;Geant4::G4vis\_management;Geant4::G4modeling;Geant4::G4interfaces;Geant4::G4mctruth;Geant4::G4geomtext;Geant4::G4analysis;Geant4::G4error\_propagation;Geant4::G4readout;Geant4::G4physicslists;Geant4::G4run;Geant4::G4event;Geant4::G4tracking;Geant4::G4parmodels;Geant4::G4processes;Geant4::G4digits\_hits;Geant4::G4track;Geant4::G4particles;Geant4::G4geometry;Geant4::G4materials;Geant4::G4graphics\_reps;Geant4::G4intercoms;Geant4::G4global;Geant4::G4tools;Geant4::G4clhep;Geant4::G4zlib;Geant4::G4ptl  
> – Configuring done (1.1s)  
> **CMake Warning at Examples/Geant4GarfieldInterface/CMakeLists.txt:34 (add\_executable):**  
> **Cannot generate a safe runtime search path for target**  
> **exampleGeant4Interface because there is a cycle in the constraint graph:**  
> **dir 0 is [/home/clouter/geant4/geant4-v11.3.0-build/BuildProducts/lib]**  
> **dir 2 must precede it due to runtime library [libG4ptl.so.3]**  
> **dir 1 is [/home/mydir/Garfield/build]**  
> **dir 2 is [/home/clouter/geant4/geant4-v11.3.0-install/lib]**  
> **dir 0 must precede it due to runtime library [libG4Tree.so]**  
> **dir 3 is [/home/clouter/root/lib]**  
> **dir 4 is [/home/mydir/garfield/build/Heed]**  
> **dir 5 is [/home/mydir/garfield/build/Magboltz]**  
> **dir 6 is [/home/mydir/garfield/build/Degrade]**  
> **Some of these libraries may not be found correctly.**  
> – Generating done (0.8s)  
> – Build files have been written to: /home/mydir/Garfield/build

* * *

After some tries, i found that the cause of all thing is that i miss GDML.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [March 7, 2025, 9:56am UTC](https://root-forum.cern.ch/t/errors-during-garfield-installation/62989/10 "2025-03-07T09:56:12Z")

</div>

Closed on March 7, 2025, 9:56am UTC

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