From dd9028f67a7cfcc4fb144bdf614a3e950ca63c22 Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Fri, 13 Feb 2026 22:58:38 +0100 Subject: gnu: Add onnx-for-onnxruntime. * gnu/packages/patches/onnx-1.17.0-for-onnxruntime.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. * gnu/packages/machine-learning.scm (onnx-1.17.0-for-onnxruntime): New variable. [source]: Use patch. Change-Id: Ib5dab812c6a0f970e65d0764a4889a3eee0ebda2 --- gnu/packages/machine-learning.scm | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'gnu/packages/machine-learning.scm') diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 3c5943961e7..6b0619f33ed 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -2080,6 +2080,45 @@ operators and standard data types.") (define-deprecated-package python-onnx onnx) +(define-public onnx-for-onnxruntime + (package + (inherit onnx) + (name "onnx-for-onnxruntime") + (source + (origin + (inherit (package-source onnx)) + (patches (append (search-patches "onnx-1.17.0-for-onnxruntime.patch") + (origin-patches (package-source onnx)))))) + ;; Use cmake-build-system instead of pyproject-build-system so that + ;; only the C++ static library is built and installed. The Python + ;; onnx package (with schemas registered) is provided by regular + ;; onnx; this variant has ONNX_DISABLE_STATIC_REGISTRATION=ON which + ;; would break onnx.shape_inference if its Python files ended up on + ;; PYTHONPATH. + (build-system cmake-build-system) + (arguments + (list + #:tests? #f ; tests fail without schema registration + #:configure-flags + #~(list "-DBUILD_SHARED_LIBS=OFF" + "-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF" + ;; Disable ONNX's schema registration so onnxruntime + ;; handles it. See + ;; . + "-DONNX_DISABLE_STATIC_REGISTRATION=ON" + "-DONNX_BUILD_TESTS=OFF" + "-DONNX_BUILD_BENCHMARKS=OFF" + "-DONNX_ML=ON" + "-DONNX_USE_LITE_PROTO=OFF" + "-DBUILD_ONNX_PYTHON=OFF"))) + (inputs (list protobuf-static-for-onnxruntime)) + (native-inputs (list python-minimal-wrapper pybind11)) + (propagated-inputs '()) + (description + "This variant of the ONNX package is built as a static C++ library +with schema registration disabled, for linking into onnxruntime. It +should not be used standalone."))) + (define-public onnx-optimizer (package (name "onnx-optimizer") -- cgit v1.3