Problem 8

Summary: Linking problem with new HP aCC compiler.
Product: Geant4 Reporter: john.allison
Component: geometryAssignee: John Apostolakis <John.Apostolakis>
Status: CLOSED INVALID    
Severity: normal    
Priority: P2    
Version: 0.1   
Hardware: HP   
OS: HP-UX   

Description john.allison 1999-08-25 04:38:06 CEST
It seems the newer aCC compiler A.01.19 (a) requires explicit
definition of static data members and (b) has problems with
static variables in inline functions.

a) Undefined static variables in G4VPhysicalVolume:
 class G4VPhysicalVolume:
  //..
   private:
    static G4RotationMatrix aRotM;
    static G4RotationMatrix IdentityRM;
  //..
 }
 G4VPhysicalVolume.cc
 G4RotationMatrix G4VPhysicalVolume::aRotM = G4RotationMatrix();
 G4RotationMatrix G4VPhysicalVolume::IdentityRM = G4RotationMatrix();

b) /usr/ccs/bin/ld: Unsatisfied symbols:
   static_rotM (data)
   static_currTranslation (data)
   static_noName (data)
gmake: *** [/afs/cern.ch/user/i/ivana/w0/geant4/bin/HP-aCC/exampleN02]
Error 1

 The remaining local static variables are in:
 G4TouchableHistory - rotM, currTranslation
 G4ParticleTable, G4VDecayChannel, G4ParticleMessenger - noName
Comment 1 John.Allison 1999-08-25 07:55:59 CEST
The compiler in question is aCC 1.21 (not 1.19 as stated below).
Comment 2 John.Allison 1999-08-30 06:55:59 CEST
> 3) Ivana, do I understand that to solve the problem you also made
>    rotM, currTranslation and noName into data members in order to fix
>    the problem?  If this is so, then if aRotM and IdentityRM are
>    properly defined *and* rotM, currTranslation and noName *still*
>    show up as unresolved then I'm sure there is a compiler bug.
>
> I will enter this into our Problem Report System for John Apostolakis
> to look at when he returns.

 Yes.

 It really seems to be a compiler bug:
 I tried to add this code in .cxx and then
 in .h file (into a member function):

  // test
  static G4ThreeVector currTranslation;
  currTranslation = G4ThreeVector();

 In case of .cxx it compiles & links ok;
 in case of .h it gives unsatisfied symbol.
Comment 3 Gabriele Cosmo 1999-10-12 13:53:59 CEST
It looks to be a compiler bug.
Comment 4 John Apostolakis 1999-11-09 08:58:59 CET
The original code simply had static variables an inline method.
This method has now been moved to the src directory, and is no longer inlined.

In this way the code is improved and the new compiler will also be helped/saved.