Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-9681

Typedef clash in global namespace between ROOT and Geant4

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 6.14/04
    • Fix Version/s: 6.16/00, 6.14/06
    • Component/s: None
    • Labels:
      None
    • Environment:

      Fedora 28; Geant4v10.3.2

      Description

      thread_lock and thread_unlock typedefs are both in the global namespace, so Geant4 and ROOT can not be used together.

      I am not sure whether this is an issue that should be fixed in ROOT or Geant4, but in either case it currently prevents us from using ROOT without working around it by removing/patching its headers.

      Steps to reproduce:

      gROOT->ProcessLine("#include \"Geant4/G4TransportationManager.hh\"");
      TVirtualMC();
      

      Error:

      /home/ol11/Projects/ship_software/sw/fedora28_x86-64/GEANT4/v10.3.2-3/include/Geant4/G4Threading.hh:186:19: error: typedef redefinition with different types ('G4int (*)(G4Mutex *)' (aka 'int (*)(int *)') vs
            'int (*)(TMCMutex *)' (aka 'int (*)(pthread_mutex_t *)'))
        typedef G4int (*thread_lock)(G4Mutex*);
                        ^
      /home/ol11/Projects/ship_software/sw/fedora28_x86-64/ROOT/master-1/include/TMCAutoLock.h:98:15: note: previous definition is here
      typedef int (*thread_lock)(TMCMutex *);
                    ^
      

      and

      /home/ol11/Projects/ship_software/sw/fedora28_x86-64/GEANT4/v10.3.2-3/include/Geant4/G4Threading.hh:187:19: error: typedef redefinition with different types ('G4int (*)(G4Mutex *)' (aka 'int (*)(int *)') vs
            'int (*)(TMCMutex *)' (aka 'int (*)(pthread_mutex_t *)'))
        typedef G4int (*thread_unlock)(G4Mutex*);
                        ^
      /home/ol11/Projects/ship_software/sw/fedora28_x86-64/ROOT/master-1/include/TMCAutoLock.h:99:15: note: previous definition is here
      typedef int (*thread_unlock)(TMCMutex *);
                    ^
      

        Attachments

          Activity

            People

            Assignee:
            ivana Ivana Hrivnacova
            Reporter:
            olantwin Oliver Lantwin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Actual End: