Message: setting G4LIB_USE_EXPAT Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question setting G4LIB_USE_EXPAT 

Forum: Installation and Configuration
Date: 04 Feb, 2014
From: Anthony Villano <Anthony Villano>

Hi,

I recently compiled Geant4.10.00 as per the online instructions. I used the CMake command:

cmake -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_SYSTEM_EXPAT=OFF -DCMAKE_INSTALL_PREFIX=/path/to/geant4.10.00-install /path/to/geant4.10.00

As you can see, I've selected for the EXPAT package to be compiled internally, because I don't want to use my system version.

After compilation of one of my standard simulations, I get the following:

/usr/bin/ld.real: cannot find -lexpat collect2: ld returned 1 exit status

Obvious: The linker is trying to find the EXPAT shared object file and can't. Since I knew this was supposed to be compiled with Geant4 I poked around in the libraries that it created and found libG4expat.so. Presumably this is the library, with 'G4' appended to let me know it was compiled with Geant, and also maybe so that my system doesn't get confused. Question then became, why are the internal Geant make files (which I deduced were responsible for creating the link line) using -lG4expat instead of -lexpat?

Looking into 'binmake.gmk' which is included into my user-defined top-level GNU make file (a simulation which I originally coded for v4.9.3), I found the following line:

ifdef G4LIB_USE_EXPAT
    LDLIBS2 += -lG4expat
endif

Which shows me that if I set the G4LIB_USE_EXPAT variable, then I'll probably use the correct link statement, indeed this worked.

Question is, why was this variable not set by my automatic G4 setup script? Presumably it 'knew' that I choose for EXPAT to be compiled with Geant4. More concretely, why did I have to do:

source /path/to/geant4.10.00-install/bin/geant4.sh source /path/to/geant4.10.00-install/share/Geant4-10.0.0/geant4make/geant4make.sh export G4LIB_USE_EXPAT=1

instead of just:

source /path/to/geant4.10.00-install/bin/geant4.sh source /path/to/geant4.10.00-install/share/Geant4-10.0.0/geant4make/geant4make.sh

Incidentally, I'm not sure why I had to source both of the above scripts anyway. The first one only set the data paths, not G4INSTALL and similar. Actually I just checked and the second one sets the data paths as well, so I could just do:

source /path/to/geant4.10.00-install/share/Geant4-10.0.0/geant4make/geant4make.sh

But I still don't understand why I had to do:

export G4LIB_USE_EXPAT=1

Is there a cleaner way?

 Add Message Add Message
to: "setting G4LIB_USE_EXPAT"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]