Can i install Xerces C++ library after installing geant4 ? and how?

Hello Experts,
can i install Xerces-C++ library after the installation of Geant4 ?
when i try to install it along with the Geant4 installation then it shows me this:-
E: unable to locate package Xerces-c+
at that time i just skipped this library and installed Geant4 successfully but now i need this.
Can someone help me with this ?
Thanks in advance!
priyanshu

If you want to be able to use GDML with your simulations, you will need to rerun your Geant4 build/install with the XercesC libraries. You do not have to start from scratch. Go back to your build directory, and run cmake . -DXercesC_DIR=<your-path-to-XercesC>. Then do make install, and it’ll only rebuild the GDML bits of G4.

If you like, you can also use ccmake and change the XercesC options interactively (use ‘t’ to toggle into the “advanced” options).

Thank you for your reply!
but let me tell you in detail that when i run the example/extended/persistency/gdml then i am able to run those examples with the gdml files exists there but when i import the other object (that has sub-parts in gdml format) from outside in gdml format, and when i run the main file it does not run, that’s why i feel to install the library XercesC .

other than this can you please tell me this-
**cmake . -DXercesC_DIR=<your-path-to-XercesC>**

what is the meaning of this , should i download the XercesC tar file or is it the path i have to set in .Bashrc file ?

and one more thing, if i want to install Geant4 in another machine with fresh then how can i install this library ?
because during when i download all the libraries that time to download this i give the command line for this…
$ sudo apt install Xerces-c++
then it shows me the message E: unable to locate package Xerces-c+
so how can i do it correctly during installation because i am going to install in another machine that’s why.
Thanks in advance !
Priyanshu

I’d guess this is an Ubuntu or Debian system, in which case the package is libxerces-c-dev, so try

$ sudo apt install libxerces-c-dev

Ubuntu provides a convenient interface to search for packages, or files in packages here: https://packages.ubuntu.com

If Xerces-C is installed on the system this way, then all you should need to do is to go back to the directory where you built Geant4 and run

cmake -DGEANT4_USE_GDML=ON .

or as Mike notes, run ccmake in the same location and use the interface to toggle that option on.

Thank you for your reply!
yes, i have run the above command $ sudo apt install libxerces-c-dev and getting that it is already installed. and this command
cmake -DGEANT4_USE_GDML=ON . also i run during the installation time of genat4.
here, i have the doubt because at that installation time
when i run $ sudo apt install Xerces-c++
then it showed me the message
E: unable to locate package Xerces-c+ that’s why i was asking about this.

This time i am having this issue
i have two gdml files in that one gdml contains all material definitions
and world definition and in other one it contains object definition.
it is just calling the name of material without defining
the material because all material definition is inside the first one.

i am trying to run the first one that has name of second one. but it is
not running that’s why i was asking for this Xerces-c package.
Can you please help me with this.
Thanks
Priyanshu

Just to clarify, can you confirm that you now have an install of Geant4 with GDML enabled?

The other question you have already posted here: Can i run two gdml files at the same time? how? so it’ll be answered there in due course.

yes.

Okay. Thank you.