Reading Branches (of ATLAS AOD File) in a Static Executable


I am trying to run over the branches of an atlas aod file following the method of
and it works fine run within ROOT / CINT or in an exe dynamically linked to the Root libraries.

But now I am trying to make a static executable. From the ROOT (5.26) src I did:
./configure -linux
make static

g++ -g -m32 -I/scratch/wbhimji/root/src/root/include -c -o IOPerformer.o IOPerformer.C
g++ -g -m32 -o IOPerformer IOPerformer.o aodb/aodbProjectSource.o -L/scratch/wbhimji/root/src/root/lib -lRoot -lm -ldl -rdynamic -lncurses -lpcre -lfreetype -pthread

where aodbProjectSource cam from doing MakeProject (on the aod file I want to run on) and IOPerformer is my exe.

First I got an error about TVirtualStreamerInfo missing so I added a line
gROOT->GetPluginManager()->AddHandler(“TVirtualStreamerInfo”, “*”,
as noted elsewhere.

But then I get:
Warning in TClass::TClass: no dictionary for class TTree is available

and an error
Error in TBufferFile::ReadClassBuffer: class: TNamed, attempting to access a wrong version: 16, object skipped at offset 76
Error in TBufferFile::CheckByteCount: object of class TNamed read too few bytes: 2 instead of 46309168

and a Segfault on reading the first entry.

Do I need to link in the dictionaries? and if so how? and will that actually solve the error.

Many thanks for any tips, trial and error is not working (!)


I think that it is a very bad idea to run with a static module. Your executable will be much bigger, the startup time slower, and you will meet the kind of problems you are reporting.
Have a look in $ROOTSYS/build/unix/ file to see the type of object modules to be linked explicitly. In standard root.exe all these files are automatically dynamically linked for you.



The reason I wanted to do this was so to be able to run a test at various (grid) sites that have different setups versions of ROOT installed (or not).

Thanks for the pointer to the script. It seems to link in a lot of libraries - will all of these be needed?



Of course not all these libs are needed. Also a reason why the executable is quite large.
You should customize this script keeping only the strict minimum for your case.