microsoft / microsoft/vcpkg

[onnx/onnxruntime] `ONNX_DISABLE_STATIC_REGISTRATION=ON` is required for onnx when used with onnxruntime?

Open
#49,060 8 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
CMake
Stars
27.5k
Forks
7.7k
Avg merge
2d 19h
Merged PRs (30d)
321

Description

Describe the bug
My program that uses onnxruntime show warning messages below at runtime:

Schema error: Trying to register schema with name Abs (domain:  version: 1) from file D:\Coding\vcpkg\buildtrees\onnx\src\v1.19.0-c251c1eccc.clean\onnx\defs\math\old.cc line 2758, but it is already registered from file D:\Coding\vcpkg\buildtrees\onnx\src\v1.19.0-c251c1eccc.clean\onnx\defs\math\old.cc line 2758

Schema error: Trying to register schema with name Add (domain:  version: 1) from file D:\Coding\vcpkg\buildtrees\onnx\src\v1.19.0-c251c1eccc.clean\onnx\defs\math\old.cc line 2642, but it is already registered from file D:\Coding\vcpkg\buildtrees\onnx\src\v1.19.0-c251c1eccc.clean\onnx\defs\math\old.cc line 2642

Schema error: Trying to register schema with name And (domain:  version: 1) from file D:\Coding\vcpkg\buildtrees\onnx\src\v1.19.0-c251c1eccc.clean\onnx\defs\logical\old.cc line 141, but it is already registered from file D:\Coding\vcpkg\buildtrees\onnx\src\v1.19.0-c251c1eccc.clean\onnx\defs\logical\old.cc line 141

Schema error: Trying to register schema with name ArgMax (domain:  version: 1) from file D:\Coding\vcpkg\buildtrees\onnx\src\v1.19.0-c251c1eccc.clean\onnx\defs\reduction\old.cc line 364, but it is already registered from file D:\Coding\vcpkg\buildtrees\onnx\src\v1.19.0-c251c1eccc.clean\onnx\defs\reduction\old.cc line 364

Schema error: Trying to register schema with name ArgMin (domain:  version: 1) from file D:\Coding\vcpkg\buildtrees\onnx\src\v1.19.0-c251c1eccc.clean\onnx\defs\reduction\old.cc line 366, but it is already registered from file D:\Coding\vcpkg\buildtrees\onnx\src\v1.19.0-c251c1eccc.clean\onnx\defs\reduction\old.cc line 366

Schema error: Trying to register schema with name AveragePool (domain:  version: 1) from file D:\Coding\vcpkg\buildtrees\onnx\src\v1.19.0-c251c1eccc.clean\onnx\defs\nn\old.cc line 2412, but it is already registered from file D:\Coding\vcpkg\buildtrees\onnx\src\v1.19.0-c251c1eccc.clean\onnx\defs\nn\old.cc line 2412

Schema error: Trying to register schema with name BatchNormalization (domain:  version: 1) from file D:\Coding\vcpkg\buildtrees\onnx\src\v1.19.0-c251c1eccc.clean\onnx\defs\nn\old.cc line 3325, but it is already registered from file D:\Coding\vcpkg\buildtrees\onnx\src\v1.19.0-c251c1eccc.clean\onnx\defs\nn\old.cc line 3325

... (And many of them)

Environment

  • OS: Win10
  • Compiler: VS 2022

To Reproduce
Just run some onnx model inference code

Expected behavior
No such warnings.

Additional context
Copilot tells me that ONNX_DISABLE_STATIC_REGISTRATION should be turned on for onnx, and it's actually mentioned here in onnxruntime port.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ports/onnxruntime/portfile.cmake, especially the ONNX_DISABLE_STATIC_REGISTRATION setting mentioned in the issue, and compare how ONNX and onnxruntime are configured. Reproduce the Windows inference case with an ONNX model and verify that the duplicate schema warnings no longer appear.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.