ROOT Version: v6.10.08 & v6.14.04
Platform: Linux
Compiler: gcc-7.3
I’m not sure if this is an issue with ROOT6 or Cling, but I get a crash and stacktrace when, within macro, the another macro is loaded twice:
void foo() {
gROOT->LoadMacro("SomeAnalysis.C");
gROOT->LoadMacro("SomeAnalysis.C"); // if commented-out, runs fine
}
No execution of the macros is necessary, only calling those two lines. Calling .L SomeAnalysis.C
twice in the interpreter also causes an error.
If the contents of SomeAnalysis.C is copied to another file, gROOT will load them ok:
void foo() {
gROOT->LoadMacro("SomeAnalysis.C");
// this works
gROOT->LoadMacro("CopyOfSomeAnalysis.C");
}
(If the copy is a hard-link or symbolic-link, it will crash)
The greater context of this is the AliRoot/AliPhysics packages for ALICE physics analyses, so this is actually very difficult to reproduce without having that whole environment installed (I’ve tried), but I don’t think it’s specific to AliRoot.
The issue appears to be duplicated symbols when including a header with a template class and some inline free functions is in the “SomeAnalysis.C” macro. In addition, specialized templates (that has been typedef’d) are included in the LinkDef already.
I’ve tried many, many permutations of preprocessor-macro guards around the code like
#if !defined(__CLING__) || defined(__ROOTCLING__)
to avoid reloading the free-functions or redefining the class, but then I get errors like operator+(double) ... not defined
.
Moving functions like operator+
into the class seems to work, but I cannot move them all.
The whole thing is rather silly, as it’s a vector class that should be replaced by TVector3, but hasn’t been, and I’m not about to change everybody’s code.
I should also say that LoadMacro is called by the code-runners in the grid system, so I don’t really have any options if I want to submit multiple analyses in the same job (besides copying the analysis macro, apparently).
There was an original error which actually might be more interesting, or provide a big hint; loading the macro would throw a lot of errors like:
E-TInterpreter::AutoParse: Error parsing payload code for class AliFemtoManager with content: ...`
/home/akubera/alice/sw/ubuntu1804_x86-64/AliPhysics/u6-pipi-1/include/AliFmThreeVectorD.h:21:34: error: typedef redefinition with different types ('AliFmThreeVector<...>' vs 'AliFmThreeVector<...>')
typedef AliFmThreeVector<double> AliFmThreeVectorD;
^
G__PWGCFfemtoscopy dictionary forward declarations' payload:114:34: note: previous definition is here
typedef AliFmThreeVector<double> AliFmThreeVectorD __attribute__((annotate("$clingAutoload$AliFmThreeVectorD.h"))) __attribute__((annotate("$clingAut...
Any help on this issue would be greatly appreciated.