Compilation failed for a toy model of SOFIE

Deart Root Expert,

I found SOFIE extremely helpful for my analysis and I was trying to integrate it into my analysis framework. However the compilation failed, and I managed to reproduce the error using some simplest toy code at:
/afs/ This code is very straightforward and I think anyone can easily reproduce. The ROOT version I used is 6.28/04.

What’s in the folder is the CMakeLists.txt and the src code higgs_analysis.cpp, and in the include folder there is the generated model.hxx file from RSofieReader. Here I am trying to include this model.hxx in the src file and infer the model output score with SofieFunctor<21, TMVA_SOFIE_testmodel::Session>(nslots).

I was compiling with the following command:
cmake … -Dtmva-sofie=ON
make -j8

The cmake step is successful but the make step returns this error:

make -j8
[ 50%] Linking CXX executable HiggsAnalysis
/cvmfs/ CMakeFiles/HiggsAnalysis.dir/higgs_analysis.cpp.o: in function `float* TMVA::Experimental::SOFIE::UTILITY::BroadcastTensor<float>(float const*, std::vector<unsigned long, std::allocator<unsigned long> > const&, std::vector<unsigned long, std::allocator<unsigned long> > const&)':
higgs_analysis.cpp:(.text._ZN4TMVA12Experimental5SOFIE7UTILITY15BroadcastTensorIfEEPT_PKS4_RKSt6vectorImSaImEESC_[_ZN4TMVA12Experimental5SOFIE7UTILITY15BroadcastTensorIfEEPT_PKS4_RKSt6vectorImSaImEESC_]+0x5c): undefined reference to `TMVA::Experimental::SOFIE::ConvertShapeToLength(std::vector<unsigned long, std::allocator<unsigned long> >)'
/cvmfs/ higgs_analysis.cpp:(.text._ZN4TMVA12Experimental5SOFIE7UTILITY15BroadcastTensorIfEEPT_PKS4_RKSt6vectorImSaImEESC_[_ZN4TMVA12Experimental5SOFIE7UTILITY15BroadcastTensorIfEEPT_PKS4_RKSt6vectorImSaImEESC_]+0x97): undefined reference to `TMVA::Experimental::SOFIE::ConvertShapeToLength(std::vector<unsigned long, std::allocator<unsigned long> >)'
collect2: error: ld returned 1 exit status
make[2]: *** [HiggsAnalysis] Error 1
make[1]: *** [CMakeFiles/HiggsAnalysis.dir/all] Error 2
make: *** [all] Error 2

Any help is appreciated!


Problem solved! In CMakeLists.txt use: find_package(ROOT REQUIRED COMPONENTS TMVA ROOTDataFrame ROOTTMVASofie ). The previous bug seems to be missing ROOTTMVASofie .

For compiling and linking the generated SOFIE files, one currently needs to link with the libROOTTMVASofie library. This is due to the use of some utility functions. We will probably remove this dependency in new ROOT versions