Problem 771 - Link errors whilst using hadronic physics lists with geant4.7.1
Summary: Link errors whilst using hadronic physics lists with geant4.7.1
Status: RESOLVED INVALID
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes/hadronic (show other problems)
Version: 7.1
Hardware: PC Linux
: P2 normal
Assignee: Gabriele Cosmo
URL:
Depends on:
Blocks:
 
Reported: 2005-07-21 02:41 CEST by ic02
Modified: 2005-07-31 20:33 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description ic02 2005-07-21 02:41:13 CEST
Dear All,
 I am encountering link errors whilst attempting to use the hadronic physics
list (LHEP_PRECO_HP). The procedure I followed is described below (this
procedure is identical to that I was using for geant4.7.0 for which I
encountered no errors) :

cd /usr/local/geant4.7.1/physics_lists/hadronic/Packaging
gmake
cd ../LHEP_PRECO_HP
gmake

this creates static libraries that reside in $G4LIB/plists/$G4SYSTEM

Then I copied GNUmakefile.user.code.example to my directory and commented out
the following lines to set the relevant link variables

EXTRALIBS += -lLHEP_PRECO_HP
EXTRALIBS += -lPackaging

and in my main file I include the header,

#include "LHEP_PRECO_HP.hh"

and declare an instance of the appropriate class:

LHEP_PRECO_HP* physics = new LHEP_PRECO_HP();
runManager->SetUserInitialization(physics);

Then, when I attempt to make the application I encounter a number of errors; the
first being:

/usr/lib/gcc-lib/i586-suse-linux/3.3.5/../../../../i586-suse-linux/bin/ld:
`.gnu.linkonce.t._ZNK23G4NeutronHPInterpolator11InterpolateE21G4InterpolationSchemeddddd'
referenced in section `.rodata' of
/usr/local/geant4.7.1/lib/Linux-g++/libG4had_neu_hp.a(G4NeutronHPVector.o):
defined in discarded section
`.gnu.linkonce.t._ZNK23G4NeutronHPInterpolator11InterpolateE21G4InterpolationSchemeddddd'
of /usr/local/geant4.7.1/lib/Linux-g++/libG4had_neu_hp.a(G4NeutronHPVector.o)

If, on the other hand, I attempt to use LHEP_BIC_HP I encounter the following
linnk error:

/home/iwan/geant4/tmp/Linux-g++/CutsBugTest/exe/CutsBugTest.o(.gnu.linkonce.t._ZN12TLHEP_BIC_HPI21G4VModularPhysicsListEC1Ev+0x254):
In function `TLHEP_BIC_HP<G4VModularPhysicsList>::TLHEP_BIC_HP[in-charge]()':
CutsBugTest.cc: undefined reference to
`HadronPhysicsLHEP_BIC_HP::HadronPhysicsLHEP_BIC_HP[in-charge](G4String const&)'

Note, I did not encounter these problems with geant4.7.0 using the environment:
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
Comment 1 Gabriele Cosmo 2005-07-26 05:13:59 CEST
You're NOT building the physics-lists package in the appropriate way.
You need to issue 'make' from the directory:
  /usr/local/geant4.7.1/physics_lists/hadronic
and NOT from:
  /usr/local/geant4.7.1/physics_lists/hadronic/Packaging
The link error you get though, seems the same related to problem report #770,
so it may be due to a system/compiler incompatibility.
Comment 2 ic02 2005-07-31 20:33:59 CEST
Yes, what you have suggested works. In the past I have built these lists using
the procedure described below (and outlined in the README file in the
physics_lists/hadronic directory). Is it plausible to build these lists as part
of the G4 installation process? For example, one could be prompted during the
Configure script if they would like electromagnetic or hadronic lists to be
built. The link error was related to system/compiler compatibility, I am still
working on this.
Regards, Iwan