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

To install TMVA SOFIE with the support for parsons ONNX file you need to install first the Google Protocol buffer library, see Protocol Buffers  |  Google Developers.
I think you can find binary built for Windows, (, but I have not tested TMVA SOFIE on Windows, If you have some problems building there, please let me know



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
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:

C:\Windows\System32>cd %USERPROFILE%
C:\Users\dmiln>git clone --branch latest-stable 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.


I then run by typing


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

But I get the error:

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:

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?



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

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

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:

unzip -d %HOME/.local
export PATH="$PATH:$HOME/.local/bin"

Next I followed the instructions at Installing ROOT - ROOT, which meant I ran the following line by line:

$ git clone --branch latest-stable 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/

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

[ 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/' '-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


-- stdout output is:

-- stderr output is:

CMake Warning:

Ignoring extra path from command line:


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:

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

But there is an error when using SOFIE:

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

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

I realise that using

git clone --branch latest-stable root_src

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

git clone 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


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

1 Like

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

I am having the same issue as described here.

This is my build command:

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

[  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/' 'CFLAGS=-O'

  See also


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

And in the log file:

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

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.


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

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

1 Like

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.


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