# Compilation failed for a toy model of SOFIE

**URL:** <https://root-forum.cern.ch/t/compilation-failed-for-a-toy-model-of-sofie/57069>\
**Category:** TMVA\
**Tags:** rdataframe\
**Created:** [November 10, 2023, 3:43am UTC](https://root-forum.cern.ch/t/compilation-failed-for-a-toy-model-of-sofie/57069 "2023-11-10T03:43:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhiyuanlcern](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/zhiyuanlcern/32/31409_2.png) [@zhiyuanlcern](https://root-forum.cern.ch/u/zhiyuanlcern)\
**Post date:** [November 10, 2023, 3:43am UTC](https://root-forum.cern.ch/t/compilation-failed-for-a-toy-model-of-sofie/57069/1 "2023-11-10T03:43:21Z")

</div>

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/cern.ch/user/z/zhiyuanl/public/SOFIE_Test.` 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:

```auto
make -j8
[50%] Linking CXX executable HiggsAnalysis
/cvmfs/sft.cern.ch/lcg/releases/binutils/2.37-355ed/x86_64-centos7/bin/ld: 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/sft.cern.ch/lcg/releases/binutils/2.37-355ed/x86_64-centos7/bin/ld: 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!

Best,  
Jordan

---

<div class="post-metadata">

**Author:** ![zhiyuanlcern](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/zhiyuanlcern/32/31409_2.png) [@zhiyuanlcern](https://root-forum.cern.ch/u/zhiyuanlcern)\
**Post date:** [November 10, 2023, 6:12am UTC](https://root-forum.cern.ch/t/compilation-failed-for-a-toy-model-of-sofie/57069/2 "2023-11-10T06:12:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [November 14, 2023, 5:05pm UTC](https://root-forum.cern.ch/t/compilation-failed-for-a-toy-model-of-sofie/57069/3 "2023-11-14T17:05:24Z")

</div>

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

Lorenzo
