IncrementalExecutor::executeFunction ... unresolved while linking function'_Z15__cling_Un1Qu30Pv'!

I’m using a class (made with TTree->MakeClass(…)) in a macro which processes a file to produce plots. However when I run the macro (using the command root -l -q -b ExampleMacro.cc) it displays the following :

Processing ExampleMacro.cc
IncrementalExecutor::executeFunction: symbol ‘_ZN13AnalysisClassC1EP5TTree’ unresolved while linking function’_Z15__cling_Un1Qu30Pv’!

After googling around I’ve only seen this issue mentioned for MAC - and people suggested upgrading to 6.02/12 (this is the version I am already using), but the machine I’m running on is Scientific Linux release 6.7.

Any ideas for what is causing the problem? (Is this a bug, or am I doing something incorrectly?) Thanks!

Hi,

can you share a reproducer?

Danilo

Sure thing!

I’ve attached a small macro that throws this error for me as well as a small ntuple (as small as I can make it) to run on. I use the command root -l -q -b ExampleMacroSimple.cc to run the code. The class I made with ttree->makeClass(…) is also attached.
ExampleMacroSimple.cc (1.81 KB)
AnalysisClass.C (1.44 KB)
AnalysisClass.h (47.3 KB)
test-hist.root (150 KB)

Hi,

thanks for the code. In this setup the symbols of Analysis class are not available: it is not enough to include the header in the macro (it would not be enough here even using a compiler, it’s not specific to ROOT interpretation of the macro).
To solve the issue, there are several ways, the simplest being:

root[0] .L AnalysisClass.C+
root[1] .x ExampleMacroSimple.cc 

Before proceeding though you have to undefine the preprocessor macro AnalysisClass_cxx with

#undef AnalysisClass_cxx

at the end of AnalysisClass.C. Said that, it is in general good practice to keep definitions and implementations separated without introducing additional preprocessor macros to intervene in the compilation of files.

I cannot see the program running as a file

/export/home/mdwerner/TagAndProbeStudy/trunk/DiVertAnalysis/Run/submitDir/hist-data15_13TeV.00276262.physics_Main.merge.DAOD_STDM4.f620_m1480_p2425.root

is not accessible for me (of course). I assume the item is solved. Let me know if this is not the case.

Cheers,
D

Thanks for this reponse - it does indeed work (FYI I attached a .root file for you to test on called “test-hist.root”, you don’t need to access the /export/…blahblah file, as both are produced by exactly the same analysis code).

I really don’t understand a lot of what you’re saying (sorry, not a programming wiz) but is there some reason why the “#undef” line isn’t automatically added to the makeClass(…)? I added it, but if I use makeClass(…) in the future I will just have to remember to do that every time?

Finally, I will be running this macro many times over with a bash script and so I need a root command friendly to that end. Rather than the root CINT command could you suggest a single line statement? Thanks!

Hi,

in case you want to run the code many times I suggest to compile it in a single executable which takes command line arguments/is configured with a configuration file.

Cheers,
Danilo

I’ve now got a problem using other bits of my code (that I removed to isolate this error).

My macro was used to make plots by creating a TCanvas and the print(…) command. Since adding this bit to my macro spits out

“Error in TInterpreter::TCling::AutoLoad: failure loading library libGQt.so for TGQt
cling::DynamicLibraryManager::loadLibrary(): libQtGui.so.4: cannot open shared object file: No such file or directory”

I’ve attached the “updated” simple code I’m using - the only change is that this attempts to make the plot and save to file. This means of saving the plots to file has worked for me a lot in the past - I don’t understand why the new commands cause it to break. (Also it is a bit annoying that it opens up all of the plots and I have to click the (x) on each one…is there a command to suppress the display?) Thanks!
ExampleMacroSimple.cc (2.13 KB)

Hi,

for running in batch mode, TROOT::SetBatch: root.cern.ch/doc/master/classTR … e48866be8d

As for the error you are seeing, it seems that the library libQtGui.so.4 is nowhere to be found. What is the output of “ldd libGQt.so”?
Also, do you know at what point in the execution this error is happening? Do you have a reproducer?

D