[packages/onnx] - build shared lib with default visibility (onnxruntime needs internals); rel 2
arekm
arekm at pld-linux.org
Sun Sep 20 22:56:51 CEST 2026
commit bd1d3388bcd66c3a22a9497ffcc60e80d9dae717
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Sun Sep 20 22:56:02 2026 +0200
- build shared lib with default visibility (onnxruntime needs internals); rel 2
onnx-default-visibility.patch | 14 ++++++++++++++
onnx.spec | 24 ++++++++----------------
2 files changed, 22 insertions(+), 16 deletions(-)
---
diff --git a/onnx.spec b/onnx.spec
index 21d5761..7793d8c 100644
--- a/onnx.spec
+++ b/onnx.spec
@@ -6,13 +6,14 @@ Summary: ONNX - Open Neural Network Exchange
Summary(pl.UTF-8): ONNX - Open Neural Network Exchange
Name: onnx
Version: 1.22.0
-Release: 1
+Release: 2
License: Apache v2.0
Group: Libraries
#Source0Download: https://github.com/onnx/onnx/releases
Source0: https://github.com/onnx/onnx/archive/v%{version}/%{name}-%{version}.tar.gz
# Source0-md5: bb6a698aa7666662cac675d15922fd33
Patch0: %{name}-soversion.patch
+Patch1: %{name}-default-visibility.patch
URL: https://onnx.ai/
BuildRequires: cmake >= 3.26
BuildRequires: libstdc++-devel >= 6:7
@@ -58,32 +59,23 @@ Pliki nagłówkowe biblioteki ONNX.
%prep
%setup -q
%patch -P0 -p1
+%patch -P1 -p1
%build
-%if %{with tests}
-# tests link library internals, which the hidden-visibility shared libonnx does not export
-%cmake -B build-static \
- -DBUILD_SHARED_LIBS=OFF \
- -DONNX_BUILD_PYTHON=OFF \
- -DONNX_BUILD_TESTS=ON \
- -DONNX_ML=ON \
- -DONNX_USE_LITE_PROTO=OFF \
- -DONNX_USE_PROTOBUF_SHARED_LIBS=ON
-
-%{__make} -C build-static
-%{__make} -C build-static test
-%endif
-
%cmake -B build \
-DBUILD_SHARED_LIBS=ON \
-DONNX_BUILD_PYTHON=OFF \
- -DONNX_BUILD_TESTS=OFF \
+ -DONNX_BUILD_TESTS=%{__ON_OFF tests} \
-DONNX_ML=ON \
-DONNX_USE_LITE_PROTO=OFF \
-DONNX_USE_PROTOBUF_SHARED_LIBS=ON
%{__make} -C build
+%if %{with tests}
+%{__make} -C build test
+%endif
+
%install
rm -rf $RPM_BUILD_ROOT
diff --git a/onnx-default-visibility.patch b/onnx-default-visibility.patch
new file mode 100644
index 0000000..2d40fc3
--- /dev/null
+++ b/onnx-default-visibility.patch
@@ -0,0 +1,14 @@
+Export everything from the shared libonnx: consumers such as onnxruntime (and onnx's
+own C++ tests) use internals beyond the ONNX_API surface, which upstream only supports
+through a static libonnx.
+
+--- onnx-1.22.0/CMakeLists.txt.orig 2026-06-15 13:54:54.000000000 +0200
++++ onnx-1.22.0/CMakeLists.txt 2026-09-20 22:32:58.678541613 +0200
+@@ -517,7 +517,6 @@
+ add_library(onnx $<TARGET_OBJECTS:onnx_proto>)
+ add_subdirectory(onnx)
+ add_dependencies(onnx onnx_proto)
+-set_target_properties(onnx PROPERTIES CXX_VISIBILITY_PRESET hidden)
+ add_onnx_global_defines(onnx)
+
+ if(ONNX_BUILD_PYTHON)
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/onnx.git/commitdiff/bd1d3388bcd66c3a22a9497ffcc60e80d9dae717
More information about the pld-cvs-commit
mailing list