| Summary: | Bug in stl_hash_fun.h for egcs compiler | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | John.Allison |
| Component: | global | Assignee: | Gabriele Cosmo <Gabriele.Cosmo> |
| Status: | CLOSED LATER | ||
| Severity: | normal | CC: | Frank.Behner, stanaka, yoshidah |
| Priority: | P2 | ||
| Version: | 0.1 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
Problem will probably go away as soon as usage of RW hash dictionaries will be removed from the code and replaced by STL map/multimap/set containers. To be expected together with the migration to ISO/ANSI C++. The following error report has been sent to egcs people by Hajime Yoshida:
I have a problem in using SGI-STL's stl_hash_fun.h.
A) platform = g++-2.95.1 ( with SGI-STL v.3.2) and Debian-2.1 Linux (Redhat-5.2,
too)
B) error
'../include/g++-3/stl_hash_fun.h:65: redefinition of `struct hash<char>'
../include/g++-3/stl_hash_fun.h:61: previous definition here
../include/g++-3/stl_hash_fun.h:65: explicit specialization of non-template
`hash<char>'
../include/g++-3/stl_hash_fun.h:67: confused by earlier errors, bailing out
C) History
1) The same error was seen with egcs-1.1.2/1.1.1 + SGI-STL v3.1.x
(default distribution of Debian or Redhat)
2) The error vanished with egcs-1.1.2/1.1.1 + SGI-STL v3.2
3) The error reappeared with gcc-2.95.1 which has SGI-STL v3.2.
We still haven't heard from egcs so problem remains RESOLVED/LATER but there is recognition that this is a bug in the compiler. As a workaround at CERN the CERN-wide version of stl_hash_fun.h has been modified, by courtesy Philippe Defert (thanks, Philippe) and tested by Maya Stavrianakou (thanks, Maya). From Maya Stavrianakou: I have rebuilt everything (incl. visualisation, excl. persistency) with G4USE_STL=1 using the standard stl_hash_fun.h from the public (/asis/i386_redhat51/usr.local/include/g++) /usr/local/include/g++/. I've also rebuilt and run my example for 1000 events. For speed, I rebuilt on my desktop Linux (pcatlas125) which is standard - the same environment as the ATLAS Linux wgs. Everything seemed to work fine! Thanks! We still haven't heard from egcs so the problem remains RESOLVED LATER, but there is now a workaround for CERN by virtue of a modified CERN-wide version of stl_hash_fun.h, courtesy Philippe Defert (thanks, Philippe). It has been tested by Maya Stavrianakou (thanks, Maya): I have rebuilt everything (incl. visualisation, excl. persistency) with G4USE_STL=1 using the standard stl_hash_fun.h from the public (/asis/i386_redhat51/usr.local/include/g++) /usr/local/include/g++/. I've also rebuilt and run my example for 1000 events. For speed, I rebuilt on my desktop Linux (pcatlas125) which is standard - the same environment as the ATLAS Linux wgs. Everything seemed to work fine! Thanks! |
egcs-1.1.1 and egcs-1.1.2 require a change to the system file stl_hash_fun.h. This is from our release notes: > > In order to compile with STL it is necessary to edit > > stl_hash_fun.h in /usr/include/g++/ or /usr/local/include/g++/. > > Lines 65-67 must be removed or commented out. These are the > > lines in question: > > > > __STL_TEMPLATE_NULL struct hash<signed char> { > > size_t operator()(unsigned char x) const { return x; } > > }; Hajime has found that egcs-1.1.2 and SGI-STL-v3.2 is OK, so an alternative is to load SGI-STL-v3.2. g++-2.95.1, which is the next version of g++ and which subsumes egcs, has SGI-STL-v3.2 but has other problems with Geant4. Our strategy is to fix things for egcs-1.1.1 and egcs-1.1.2 and wait for a stable version of the new g++.