# \[Fix\] TMVA SOFIE ONNX Parser missing in ROOT 6.36 build on Ubuntu 24.04 (WSL2)

**URL:** <https://root-forum.cern.ch/t/fix-tmva-sofie-onnx-parser-missing-in-root-6-36-build-on-ubuntu-24-04-wsl2/64526>\
**Category:** ROOT\
**Tags:** tmva, root\
**Created:** [December 8, 2025, 5:14pm UTC](https://root-forum.cern.ch/t/fix-tmva-sofie-onnx-parser-missing-in-root-6-36-build-on-ubuntu-24-04-wsl2/64526 "2025-12-08T17:14:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![SHLOK\_SAXENA](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/shlok_saxena/32/39605_2.png) [@SHLOK\_SAXENA](https://root-forum.cern.ch/u/SHLOK_SAXENA)\
**Post date:** [December 8, 2025, 5:14pm UTC](https://root-forum.cern.ch/t/fix-tmva-sofie-onnx-parser-missing-in-root-6-36-build-on-ubuntu-24-04-wsl2/64526/1 "2025-12-08T17:14:06Z")

</div>

* * *

Hi everyone,

I wanted to share a solution for a build issue I encountered while compiling ROOT v6.36 (latest source) on Ubuntu 24.04 (WSL2).

### The Issue

Even after installing `protobuf-compiler` and `libprotobuf-dev`, and enabling `-Dtmva-sofie=ON`, the build would complete successfully, but the `RModelParser_ONNX` class was missing from the `TMVA::Experimental::SOFIE` namespace.

When running the SOFIE ONNX tutorials, this resulted in the compiler error: `error: no type named 'RModelParser_ONNX' in namespace 'TMVA::Experimental::SOFIE'`

### The Cause

It appears that CMake fails to correctly propagate the Protobuf include/library paths to the internal TMVA build flags in this environment. Although CMake logs “Found Protobuf,” the internal preprocessor guards likely fail, causing the ONNX implementation to be silently skipped during the compilation of `libTMVA.so`.

**The Solution:**  
I successfully fixed this by explicitly passing the library paths to CMake to force detection. If anyone else faces this on a modern Linux distro, here is the working configuration:

`cmake ../root_src`  
`-Dtmva-sofie=ON`  
`-DProtobuf_LIBRARY=/usr/lib/x86_64-linux-gnu/libprotobuf.so`  
`-DProtobuf_INCLUDE_DIR=/usr/include`

(Verify your specific libprotobuf path using `find /usr -name libprotobuf.so` if it differs).

After a clean rebuild (`make -j4`), the ONNX parser is correctly linked and the tutorials run perfectly.

Hope this saves some time for others!

Best, Shlok.

---

<div class="post-metadata">

**Author:** ![mczurylo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mczurylo/32/33269_2.png) [@mczurylo](https://root-forum.cern.ch/u/mczurylo)\
**Post date:** [December 9, 2025, 1:59pm UTC](https://root-forum.cern.ch/t/fix-tmva-sofie-onnx-parser-missing-in-root-6-36-build-on-ubuntu-24-04-wsl2/64526/2 "2025-12-09T13:59:26Z")

</div>

Hi @SHLOK_SAXENA,

thank you for your question, maybe @moneta could help here?

Cheers,

Marta

---

<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:** [December 9, 2025, 5:11pm UTC](https://root-forum.cern.ch/t/fix-tmva-sofie-onnx-parser-missing-in-root-6-36-build-on-ubuntu-24-04-wsl2/64526/3 "2025-12-09T17:11:09Z")

</div>

Hi Shlok,

Thank you for posting the solution! I don’t know what could be causing cmake not to find protobuf automatically; I would need to see the log file, but it is great you posted the solution which works

Best,

Lorenzo

---

<div class="post-metadata">

**Author:** ![SHLOK\_SAXENA](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/shlok_saxena/32/39605_2.png) [@SHLOK\_SAXENA](https://root-forum.cern.ch/u/SHLOK_SAXENA)\
**Post date:** [December 9, 2025, 6:02pm UTC](https://root-forum.cern.ch/t/fix-tmva-sofie-onnx-parser-missing-in-root-6-36-build-on-ubuntu-24-04-wsl2/64526/4 "2025-12-09T18:02:26Z")

</div>

Hi Lorenzo,

Thank you for the response!

I checked my build logs. Since I am using a newer version of CMake (on Ubuntu 24.04), it generated a `CMakeConfigureLog.yaml` instead of the traditional output/error logs. I attempted to attach the file, but the forum is currently restricting attachments for my new account.

However, I can confirm that manually passing the paths forced the correct configuration. The `CMakeCache` now explicitly shows:

`Protobuf_INCLUDE_DIR:PATH=/usr/include Protobuf_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libprotobuf.so`

On a separate note: While exploring the source code to fix this, I noticed that the current ONNX implementation lacks support for **Transformer** operators (like `MultiHeadAttention`, `GELU`, and `LayerNormalization`). I know these are becoming standard in HEP for tasks like particle tagging (ParT).

I would be very interested in helping to implement these. Do you think adding Transformer support would be a suitable topic for a GSoC project this coming year? I would love to work on it.

Best,

Shlok

---

<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:** [December 9, 2025, 6:10pm UTC](https://root-forum.cern.ch/t/fix-tmva-sofie-onnx-parser-missing-in-root-6-36-build-on-ubuntu-24-04-wsl2/64526/5 "2025-12-09T18:10:59Z")

</div>

Hi,

I will try to check with the new ububuntu and see if I can reproduce the error.

For the implementation of new operators, we support Transformer models, like the ATLAS\_GN2 model or CaloDiT2 for diffusion, but the Transformer block (the Attention layer) is impelmented as a series of several ONNX operators. We could implement directly the MultiHead Attention, if needed.  
Normally, when exporting from PyTorch to ONNX you get a series of lower level ONNX operators.  
LayerNormalization is supported, but probably in 6.38. GELU can also easly be added if needed.  
Yes, sure adding new operators could be a suitable GSOC project, you are welcomed to apply for it.

Thank you for the interest!

Best,

Lorenzo

---

<div class="post-metadata">

**Author:** ![SHLOK\_SAXENA](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/shlok_saxena/32/39605_2.png) [@SHLOK\_SAXENA](https://root-forum.cern.ch/u/SHLOK_SAXENA)\
**Post date:** [December 9, 2025, 6:52pm UTC](https://root-forum.cern.ch/t/fix-tmva-sofie-onnx-parser-missing-in-root-6-36-build-on-ubuntu-24-04-wsl2/64526/6 "2025-12-09T18:52:19Z")

</div>

Hi,

Thank you for the detailed clarification and the encouragement!

That makes perfect sense regarding the current decomposition approach. However, I suspect that implementing a dedicated (fused) **`MultiHeadAttention`** operator would offer significant performance benefits over running it as a series of smaller operations (MatMul, Softmax, etc.).

A fused kernel could reduce memory access overhead and generate cleaner C++ code for modern architectures like **CaloDiT2**.

Since `LayerNormalization` is already planned for 6.38, I would propose focusing my GSoC project on:

1. Implementing the fused `MultiHeadAttention` operator for high-performance inference.

2. Adding `GELU` (and potentially other missing activations like `Einsum` if needed).

3. Benchmarking the new “Fused” implementation against the current “Decomposed” approach to quantify the speedup.

I will start studying the `RModelParser_ONNX` source code to familiarize myself with the operator registration system. If there are any specific files or benchmarks you recommend I look at first, I would appreciate the guidance!

Best,

Shlok

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [December 23, 2025, 6:52pm UTC](https://root-forum.cern.ch/t/fix-tmva-sofie-onnx-parser-missing-in-root-6-36-build-on-ubuntu-24-04-wsl2/64526/7 "2025-12-23T18:52:34Z")

</div>

Closed on December 23, 2025, 6:52pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
