Problem 8 - Linking problem with new HP aCC compiler.
Summary: Linking problem with new HP aCC compiler.
Status: CLOSED INVALID
Alias: None
Product: Geant4
Classification: Unclassified
Component: geometry (show other problems)
Version: 0.1
Hardware: HP HP-UX
: P2 normal
Assignee: John Apostolakis
URL:
Depends on:
Blocks:
 
Reported: 1999-08-25 04:38 CEST by john.allison
Modified: 2000-02-28 08:54 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
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.