[packages/onnxruntime] Rel 2

arekm arekm at pld-linux.org
Mon Sep 21 19:06:20 CEST 2026


commit dfcc8e7a91581c3b2cb6061f6bdce8c71398534e
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Mon Sep 21 19:05:00 2026 +0200

    Rel 2

 onnxruntime-system-libs.patch | 15 +++++++++++++--
 onnxruntime.spec              | 26 +++++++++++++++++---------
 2 files changed, 30 insertions(+), 11 deletions(-)
---
diff --git a/onnxruntime.spec b/onnxruntime.spec
index a2ecb85..5956e14 100644
--- a/onnxruntime.spec
+++ b/onnxruntime.spec
@@ -8,7 +8,7 @@ Summary:	ONNX Runtime - cross-platform inference engine for ONNX models
 Summary(pl.UTF-8):	ONNX Runtime - wieloplatformowy silnik wnioskowania dla modeli ONNX
 Name:		onnxruntime
 Version:	1.30.0
-Release:	1
+Release:	2
 License:	MIT
 Group:		Libraries
 #Source0Download: https://github.com/microsoft/onnxruntime/releases
@@ -29,7 +29,9 @@ BuildRequires:	libstdc++-devel >= 6:11
 BuildRequires:	microsoft-gsl-devel >= 4.0
 BuildRequires:	ninja
 BuildRequires:	nlohmann-json-devel >= 3.10
-BuildRequires:	onnx-devel
+# onnx 1.23 adds FLOAT6 tensor types unknown to the element-size map (static_assert)
+BuildRequires:	onnx-devel >= 1.22
+BuildRequires:	onnx-devel < 1.23
 BuildRequires:	protobuf-devel
 BuildRequires:	python3 >= 1:3.10
 %if %{with python3}
@@ -45,6 +47,10 @@ BuildRequires:	rpmbuild(macros) >= 1.605
 BuildRequires:	safeint-devel
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
+# TLS symbol _ZN6google8protobuf8internal15ThreadSafeArena13thread_cache_E comes from
+# libprotobuf (DT_NEEDED, ldd -r clean); the checker misreads undefined TLS objects
+%define		skip_post_check_so libonnxruntime.so.*
+
 %description
 ONNX Runtime is a cross-platform inference and training accelerator
 for machine learning models in the ONNX format. This package contains
@@ -72,10 +78,6 @@ Summary:	Python 3 bindings for ONNX Runtime
 Summary(pl.UTF-8):	Wiązania Pythona 3 do ONNX Runtime
 Group:		Libraries/Python
 Requires:	%{name} = %{version}-%{release}
-Requires:	python3-flatbuffers
-Requires:	python3-numpy >= 1.21.6
-Requires:	python3-packaging
-Requires:	python3-protobuf >= 4.25.8
 
 %description -n python3-onnxruntime
 Python 3 bindings for ONNX Runtime.
@@ -111,9 +113,9 @@ Wiązania Pythona 3 do ONNX Runtime.
 %ninja_build -C build
 
 %if %{with python3}
-# cmake assembles the python package (sources + setup.py) in the build dir
+# cmake assembles the python package tree in the build dir; setup.py expects to run there
 cd build
-%py3_build
+%{__python3} ../setup.py build --build-base=build-3
 cd ..
 %endif
 
@@ -124,8 +126,13 @@ rm -rf $RPM_BUILD_ROOT
 
 %if %{with python3}
 cd build
-%py3_install
+%{__python3} ../setup.py build --build-base=build-3 install --skip-build --optimize=2 --root=$RPM_BUILD_ROOT
 cd ..
+
+# setup.py bundles copies of the libraries; point at the packaged ones instead
+for l in libonnxruntime.so.%{version} libonnxruntime_providers_shared.so; do
+	ln -sf %{_libdir}/$l $RPM_BUILD_ROOT%{py3_sitedir}/onnxruntime/capi/$l
+done
 %endif
 
 %clean
@@ -151,6 +158,7 @@ rm -rf $RPM_BUILD_ROOT
 %if %{with python3}
 %files -n python3-onnxruntime
 %defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/onnxruntime_test
 %{py3_sitedir}/onnxruntime
 %{py3_sitedir}/onnxruntime-%{version}-py*.egg-info
 %endif
diff --git a/onnxruntime-system-libs.patch b/onnxruntime-system-libs.patch
index 7c0a517..ead880a 100644
--- a/onnxruntime-system-libs.patch
+++ b/onnxruntime-system-libs.patch
@@ -1,9 +1,10 @@
 Build against system Eigen, Boost.MP11 and cpuinfo instead of fetching them:
 these three are declared without FIND_PACKAGE_ARGS (or via FetchContent_Populate),
 so find_package() is never tried and the build tries to download at configure time.
+A flatbuffers built shared-only exports flatbuffers::flatbuffers_shared; alias it.
 
 --- onnxruntime-1.30.0/cmake/external/onnxruntime_external_deps.cmake	2026-09-10 08:09:41.000000000 +0200
-+++ onnxruntime-1.30.0/cmake/external/onnxruntime_external_deps.cmake	2026-09-20 20:12:50.908169462 +0200
++++ onnxruntime-1.30.0/cmake/external/onnxruntime_external_deps.cmake	2026-09-20 21:49:21.720526967 +0200
 @@ -288,17 +288,8 @@
       message(STATUS "Aliasing Boost::headers to Boost::mp11")
       add_library(Boost::mp11 ALIAS Boost::headers)
@@ -78,7 +79,17 @@ so find_package() is never tried and the build tries to download at configure ti
    if(TARGET cpuinfo::cpuinfo AND NOT TARGET cpuinfo)
      message(STATUS "Aliasing cpuinfo::cpuinfo to cpuinfo")
      add_library(cpuinfo ALIAS cpuinfo::cpuinfo)
-@@ -556,11 +502,7 @@
+@@ -482,6 +428,9 @@
+ )
+ 
+ onnxruntime_fetchcontent_makeavailable(flatbuffers)
++if(flatbuffers_FOUND AND NOT TARGET flatbuffers::flatbuffers AND TARGET flatbuffers::flatbuffers_shared)
++  add_library(flatbuffers::flatbuffers ALIAS flatbuffers::flatbuffers_shared)
++endif()
+ if(NOT flatbuffers_FOUND)
+   if(NOT TARGET flatbuffers::flatbuffers)
+     add_library(flatbuffers::flatbuffers ALIAS flatbuffers)
+@@ -556,11 +505,7 @@
    message(STATUS "Aliasing ONNX::onnx_proto to onnx_proto")
    add_library(onnx_proto ALIAS ONNX::onnx_proto)
  endif()
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/onnxruntime.git/commitdiff/dfcc8e7a91581c3b2cb6061f6bdce8c71398534e



More information about the pld-cvs-commit mailing list