# Install ROOT/TMVA SOFIE

**URL:** <https://root-forum.cern.ch/t/install-root-tmva-sofie/48754>\
**Category:** Newbie\
**Tags:** root\
**Created:** [February 10, 2022, 9:09pm UTC](https://root-forum.cern.ch/t/install-root-tmva-sofie/48754 "2022-02-10T21:09:40Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![dilne](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dilne/32/28766_2.png) [@dilne](https://root-forum.cern.ch/u/dilne)\
**Post date:** [February 10, 2022, 9:09pm UTC](https://root-forum.cern.ch/t/install-root-tmva-sofie/48754/1 "2022-02-10T21:09:40Z")

</div>

Hi, I was very impressed when I recently discovered ROOT/TMVA SOFIE on GitHub (/root-project/root/tree/master/tmva/sofie). I am interested in taking an AI/ML/DL ONNX model I have and using SOFIE to create a .hxx file for easy C++ inference. It would be awesome if I could do this but I am having issues installing. The ROOT/TMVA SOFIE GitHub page says to use `cmake ../root -Dtmva-sofie=ON`, however, what are the basic steps required to get to this stage? The ROOT installation page at cern does not show code similar to this so I’m not sure where to implement this command.

So my question is, how can I install ROOT/TMVA SOFIE on Windows 10?

Many thanks

---

<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:** [February 11, 2022, 8:39am UTC](https://root-forum.cern.ch/t/install-root-tmva-sofie/48754/2 "2022-02-11T08:39:09Z")

</div>

Hi,  
To install TMVA SOFIE with the support for parsons ONNX file you need to install first the Google Protocol buffer library, see [Protocol Buffers &nbsp;|&nbsp; Google Developers](https://developers.google.com/protocol-buffers).  
I think you can find binary built for Windows, ([https://github.com/protocolbuffers/protobuf/releases](https://github.com/protocolbuffers/protobuf/releases)), but I have not tested TMVA SOFIE on Windows, If you have some problems building there, please let me know

Cheers

Lorenzo

---

<div class="post-metadata">

**Author:** ![dilne](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dilne/32/28766_2.png) [@dilne](https://root-forum.cern.ch/u/dilne)\
**Post date:** [February 11, 2022, 11:51am UTC](https://root-forum.cern.ch/t/install-root-tmva-sofie/48754/3 "2022-02-11T11:51:31Z")

</div>

Hi Lorenzo,

Thank you kindly for your response. I have installed the Protocol buffer library. I’m still having some problems however. Here is my process, hopefully it is in sufficient detail:

Downloaded protobuff x64 for Windows  
Unzipped  
Moved files to C:\protoc-3.19.4-win64  
Added C:\protoc-3.19.4-win64\bin to environment paths - by opening System Properties \> Environment Variables… \> New (under System variables)

As administrator, opened x86 Native Tools Command Prompt for VS 2019

Then run line by line:

```auto
C:\Windows\System32>cd %USERPROFILE%
C:\Users\dmiln>git clone --branch latest-stable https://github.com/root-project/root.git root_src
C:\Users\dmiln>mkdir root_build root_install && cd root_build
C:\Users\dmiln\root_build>cmake -G"Visual Studio 16 2019" -A Win32 -Thost=x64 -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_PREFIX=../root_install ../root_src -Dtmva-sofie=ON
C:\Users\dmiln\root_build>cmake --build . --config Release --target install

```

At this stage, I get 366 warnings, 0 errors however.

`C:\Users\dmiln\root_build>..\root_install\bin\thisroot.bat`

I then run by typing

`root`

To test, I try:  
`using namespace TMVA::Experimental;`

But I get the error:

```auto
root [0] using namespace TMVA::Experimental;
ROOT_prompt_0:1:17: error: use of undeclared identifier 'TMVA'
using namespace TMVA::Experimental;

```

I also try this but get an error too:

```auto
root [1] SOFIE::RModelParser_ONNX parser;
ROOT_prompt_1:1:1: error: 'SOFIE' is not a class, namespace, or enumeration
SOFIE::RModelParser_ONNX parser;

```

What do you think are the first steps to try resolve this issue?

Cheers,

dilne

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [February 11, 2022, 1:38pm UTC](https://root-forum.cern.ch/t/install-root-tmva-sofie/48754/4 "2022-02-11T13:38:24Z")

</div>

Hi, sorry, but ROOT and SOFIE doesn’t work (and doesn’t even compile) on Windows yet. I’m looking into it

---

<div class="post-metadata">

**Author:** ![dilne](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dilne/32/28766_2.png) [@dilne](https://root-forum.cern.ch/u/dilne)\
**Post date:** [February 11, 2022, 1:41pm UTC](https://root-forum.cern.ch/t/install-root-tmva-sofie/48754/5 "2022-02-11T13:41:36Z")

</div>

Thanks for your response, I’ll try on Mac OS.  
Cheers

---

<div class="post-metadata">

**Author:** ![dilne](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dilne/32/28766_2.png) [@dilne](https://root-forum.cern.ch/u/dilne)\
**Post date:** [February 11, 2022, 9:49pm UTC](https://root-forum.cern.ch/t/install-root-tmva-sofie/48754/6 "2022-02-11T21:49:46Z")

</div>

Hi, I have tried installing SOFIE on Mac OS, but I am met with errors again. Here is my process:

I have xcode already installed. I downloaded Protobuf then ran:

```auto
unzip protoc-3.19.4-osc-x86_64.zip -d %HOME/.local
export PATH="$PATH:$HOME/.local/bin"

```

Next I followed the instructions at [Installing ROOT - ROOT](https://root.cern/install/#build-from-source), which meant I ran the following line by line:

```auto
$ git clone --branch latest-stable https://github.com/root-project/root.git root_src
$ mkdir root_build root_install && cd root_build
$ cmake -DCMAKE_INSTALL_PREFIX=../root_install ../root_src -Dtmva-sofie=ON
$ cmake --build . -- install -j3
$ source ../root_install/bin/thisroot.sh

```

I was met with an error 48% into the build:

```auto
[48%] Built target MetaCling

[48%] **Creating directories for 'clad'**

[48%] **Performing download step (git clone) for 'clad'**

-- clad download command succeeded. See also /Users/danielmilne/root_build/interpreter/cling/tools/plugins/clad/clad-prefix/src/clad-stamp/clad-download-*.log

[48%] **No update step for 'clad'**

[48%] **No patch step for 'clad'**

[48%] **Performing configure step for 'clad'**

CMake Error at /Users/danielmilne/root_build/interpreter/cling/tools/plugins/clad/clad-prefix/src/clad-stamp/clad-configure-Release.cmake:37 (message):

Command failed: 1

'/Applications/CMake.app/Contents/bin/cmake' '-G' 'Unix Makefiles' '-DCMAKE_BUILD_TYPE=Release' '-DCMAKE_C_COMPILER=/Library/Developer/CommandLineTools/usr/bin/cc' '-DCMAKE_C_FLAGS= -m64 -pipe -W -Wall -fsigned-char -fno-common -Qunused-arguments -pthread -fPIC' '-DCMAKE_CXX_COMPILER=/Library/Developer/CommandLineTools/usr/bin/c++' '-DCMAKE_CXX_FLAGS= -std=c++11 -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -m64 -pipe -W -Wall -Woverloaded-virtual -fsigned-char -fno-common -Qunused-arguments -pthread -stdlib=libc++ -D __STDC_CONSTANT_MACROS -D__ STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fno-strict-aliasing -Wwrite-strings -Wno-shadow -Wno-unused-parameter -Wno-deprecated-declarations -fPIC -fno-rtti' '-DCMAKE_CXX_STANDARD=11' '-DCMAKE_INSTALL_PREFIX=/Users/danielmilne/root_build/etc/cling//plugins' '-DLLVM_DIR=/Users/danielmilne/root_build/interpreter/llvm/src' '-DClang_DIR=/Users/danielmilne/root_build/interpreter/llvm/src/tools/clang/' '-DCLANG_INCLUDE_DIRS=/Users/danielmilne/root_src/interpreter/llvm/src/tools/clang/include' '/Users/danielmilne/root_build/interpreter/llvm/src/tools/clang/include' '-DCLAD_BUILD_STATIC_ONLY=ON' '-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON' '-DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk' '-GUnix Makefiles' '/Users/danielmilne/root_build/interpreter/cling/tools/plugins/clad/clad-prefix/src/clad'

See also

/Users/danielmilne/root_build/interpreter/cling/tools/plugins/clad/clad-prefix/src/clad-stamp/clad-configure-*.log

-- stdout output is:

-- stderr output is:

CMake Warning:

Ignoring extra path from command line:

/Users/danielmilne/root_build/interpreter/cling/tools/plugins/clad/clad-prefix/src/clad

CMake Error: The source directory "/Users/danielmilne/root_build/interpreter/llvm/src/tools/clang/include" does not appear to contain CMakeLists.txt.

Specify --help for usage, or press the help button on the CMake GUI.

CMake Error at /Users/danielmilne/root_build/interpreter/cling/tools/plugins/clad/clad-prefix/src/clad-stamp/clad-configure-Release.cmake:47 (message):

Stopping after outputting logs.

make[2]: *** [interpreter/cling/tools/plugins/clad/clad-prefix/src/clad-stamp/clad-configure] Error 1

make[1]: *** [interpreter/cling/tools/plugins/clad/CMakeFiles/clad.dir/all] Error 2

make: *** [all] Error 2

```

I did the process again but I ignored clad by adding to the cmake line:  
`cmake -DCMAKE_INSTALL_PREFIX=../root_install ../root_src -Dtmva-sofie=ON -Dclad=OFF`

This built successfully and I tried the following which didn’t throw an error like in my broken Windows build:

```auto

root [0] using namespace **TMVA** ::Experimental;

```

But there is an error when using SOFIE:

```auto
root [1] SOFIE::RModelParser_ONNX parser;

**ROOT_prompt_1:1:1:**  **error:**  **'SOFIE' is not a class, namespace, or enumeration**

SOFIE::RModelParser_ONNX parser;

**^**

**ROOT_prompt_1:1:1: note:**'SOFIE' declared here

```

How can I go about fixing this error, presumably it is something to do with ignoring clad?  
Many thanks for any help you can provide

**Edit:**  
Some versions which may be useful:  
Mac OS - 12.0.1  
XCode - 13.2.1  
Protocol Buffers - 3.19.4  
Root - 6.20/06

---

<div class="post-metadata">

**Author:** ![dilne](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dilne/32/28766_2.png) [@dilne](https://root-forum.cern.ch/u/dilne)\
**Post date:** [February 13, 2022, 6:24pm UTC](https://root-forum.cern.ch/t/install-root-tmva-sofie/48754/7 "2022-02-13T18:24:03Z")

</div>

I realise that using

`git clone --branch latest-stable https://github.com/root-project/root.git root_src`

downloads the latest stable release, which doesn’t actually contain SOFIE. Using:

`git clone https://github.com/root-project/root.git root_src`

will download the master version that includes SOFIE. Thank you both for your help. I will retry with this version and open a new post should I come across any issues. Thanks again for the help

---

<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:** [February 14, 2022, 8:43am UTC](https://root-forum.cern.ch/t/install-root-tmva-sofie/48754/8 "2022-02-14T08:43:57Z")

</div>

Hi,

TMVA SOFIE is included either in the ROOT maste, or in the 6.26 branch, `v6-26-00-patches`.

---

<div class="post-metadata">

**Author:** ![jarm](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jarm/32/29361_2.png) [@jarm](https://root-forum.cern.ch/u/jarm)\
**Post date:** [April 6, 2022, 11:45am UTC](https://root-forum.cern.ch/t/install-root-tmva-sofie/48754/9 "2022-04-06T11:45:49Z")

</div>

I am also trying to build SOFIE on macOS Monterey 12.3 with Apple Silicon and experiencing issues.

> [@Installing ROOT 6.22.08 on Apple Silicon (arm64) AfterImage, FreeType issues and a linker error](https://root-forum.cern.ch/t/installing-root-6-22-08-on-apple-silicon-arm64-afterimage-freetype-issues-and-a-linker-error/44364):
>
> Has anyone had any luck with compiling ROOT on Apple M1? I am getting issues with AfterImage and FreeType, where basically the configure steps are failing because they don’t recognise arch=arm64. This is the error for AfterImage, and it is basically the same error when trying to build the builtin FreeType. I can’t not use the builtin freetype as it’s for some reason needed for building a Cocoa app. Similarly I can’t find an up to date libAfterImage anywhere. CMake Error at /Users/stuartwalke…

I am having the same issue as described here.

This is my build command:

```auto
cmake -DCMAKE_INSTALL_PREFIX=../root_install ../ -Dtmva-sofie=ON -Dtmva-pymva=On -DPython3_EXECUTABLE=/opt/homebrew/Caskroom/miniforge/base/envs/rootcern/bin/python

```

And similarly I get

```auto
[0%] Creating directories for 'FREETYPE'
[0%] Performing download step (verify and extract) for 'FREETYPE'
-- FREETYPE download command succeeded. See also /root_src/root_build/FREETYPE-prefix/src/FREETYPE-stamp/FREETYPE-download-*.log
[0%] No update step for 'FREETYPE'
[0%] No patch step for 'FREETYPE'
[0%] Performing configure step for 'FREETYPE'
CMake Error at /root_src/root_build/FREETYPE-prefix/src/FREETYPE-stamp/FREETYPE-configure-.cmake:49 (message):
  Command failed: 2

   './configure' '--prefix' '/root_src/root_build/FREETYPE-prefix' '--with-pic' '--disable-shared' '--with-png=no' '--with-bzip2=no' '--with-harfbuzz=no' 'CC=/opt/homebrew/Caskroom/miniforge/base/envs/rootcern/bin/arm64-apple-darwin20.0.0-clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' 'CFLAGS=-O'

  See also

    /root_src/root_build/FREETYPE-prefix/src/FREETYPE-stamp/FREETYPE-configure-*.log

make[2]: *** [FREETYPE-prefix/src/FREETYPE-stamp/FREETYPE-configure] Error 1
make[1]: *** [CMakeFiles/FREETYPE.dir/all] Error 2

```

And in the log file:

```auto
Invalid configuration `arm64-apple-darwin20.0.0': machine `arm64-apple' not recognized
configure: error: /bin/sh ./config.sub arm64-apple-darwin20.0.0 failed
make[3]: *** [setup] Error 1

```

Any ideas how to work around this?

I see the same issue reported here: [Build error on M1 Macbook (while building freetype): "Invalid configuration `arm64-apple-darwin20.5.0': machine `arm64-apple' not recognized" · Issue #20661 · matplotlib/matplotlib · GitHub](https://github.com/matplotlib/matplotlib/issues/20661)

Any tips appreciated!

Based on a chat with @sdwalker I tried `-Dbuiltin_freetype=OFF`, but this did not prevent ROOT from trying to build FreeType somehow.

---

<div class="post-metadata">

**Author:** ![dilne](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dilne/32/28766_2.png) [@dilne](https://root-forum.cern.ch/u/dilne)\
**Post date:** [April 6, 2022, 6:30pm UTC](https://root-forum.cern.ch/t/install-root-tmva-sofie/48754/10 "2022-04-06T18:30:42Z")

</div>

Hi,

I was able to fix my installation issues on Mac and have a post at this thread that shows my installation code: [Errors Installing ROOT with TMVA SOFIE on Mac OS - #3 by dilne](https://root-forum.cern.ch/t/errors-installing-root-with-tmva-sofie-on-mac-os/48783/3)

I didn’t have the issues you described, likely because I was installing on an Intel Mac, however, there’s a small chance this could help so I thought I’d post just in case

---

<div class="post-metadata">

**Author:** ![jarm](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jarm/32/29361_2.png) [@jarm](https://root-forum.cern.ch/u/jarm)\
**Post date:** [April 6, 2022, 8:09pm UTC](https://root-forum.cern.ch/t/install-root-tmva-sofie/48754/11 "2022-04-06T20:09:56Z")

</div>

Thanks @dilne. I have another Intel Mac here and did manage to compile root there.

It would be great to do this on Apple Silicon too of course. Maybe soon that will sort itself out.

---

<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:** [April 7, 2022, 2:58pm UTC](https://root-forum.cern.ch/t/install-root-tmva-sofie/48754/12 "2022-04-07T14:58:20Z")

</div>

Hi,

I have no problem building ROOT with support for SOFIE on M1 MacOS using builtin freestyle. Which ROOT versions are you trying to compile ?

Lorenzo
