ROOT Version: v6.16
Platform: Linux (CC7)
Compiler: gcc 4.8.5
Dear everybody,
I’m not sure whether this issue is more related to RDataFrame or rather to rootcling. I prepared an example which defines a class “testclass” just holding an integer variable which can be accessed by a getter and setter “getVal()”, " setVal". This class is inherent from TObject to use ROOTs I/O features. Then there is the main.cpp which contains a function to write instances of this class into a rootfile and another function to read this file again into a dataframe. A filter is applied using the feature of interpreting the string (I guess at runtime, right?) as follows:
auto df = d.Filter(“b0.getVal() < 5”);
This example work pretty fine if everything is executed within the root framework a la:
root [0] .L testclass.cxx+
root [1] .L main.cpp
root [2] writeTree()
root [3] readTree()
5 entries passed all filters
However if I compile all files into a standalone app using the attached makefile I get the following error at runtime:
input_line_44:1:49: error: variable has incomplete type ‘testclass’
namespace __tdf_0{ auto tdf_f = {testclass b0;
^
G__testclass dictionary forward declarations’ payload:5:402: note: forward declaration of ‘testclass’
…__attribute__((annotate("$clingAutoload$testclass.hxx"))) testclass;
^
terminate called after throwing an instance of ‘std::runtime_error’
what(): Cannot interpret the following expression:
b0.getVal() < 5
Make sure it is valid C++.
Aborted (core dumped)
By coincidence I found that if I remove the *rdict.pcm, so that the header of testclass.hxx must be reparsed at runtime, it work. It seems like there are some information missing in the rdict.pcm which are required to interpret the filter string “b0.getVal() < 5”. May I do something wrong when generating the dictionary using rootcling?
I could reproduce the error on lxplus7 and on MacOS.
rdf_rdict.tar.gz (1.5 KB)
Many thanks in advance,
Kai