From 4f7ffd42693aabb09b5210416a03ddaa1cd54f86 Mon Sep 17 00:00:00 2001 From: Chunmei Xu Date: Wed, 27 Dec 2023 22:44:53 +0800 Subject: [PATCH] rebuild with protobuf-3.20.2 Signed-off-by: Chunmei Xu --- onnx.spec | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/onnx.spec b/onnx.spec index f587a02..aba95b8 100644 --- a/onnx.spec +++ b/onnx.spec @@ -1,4 +1,6 @@ -%define anolis_release 2 +%define anolis_release 3 + +%global protobuf_ver 3.20.2 Name: onnx Version: 1.14.0 Release: %{anolis_release}%{?dist} @@ -9,10 +11,12 @@ URL: https://github.com/onnx/onnx Source0: https://github.com/onnx/onnx/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz BuildRequires: doxygen cmake gcc-c++ -BuildRequires: python3-devel python3-setuptools protobuf-devel -BuildRequires: pybind11-devel python3-pytest-runner python3-protobuf +BuildRequires: python3-devel python3-setuptools +# use onnx recommend protobuf version +BuildRequires: protobuf-devel = %{protobuf_ver} python3-protobuf = %{protobuf_ver} +BuildRequires: pybind11-devel python3-pytest-runner -Requires: wget +Requires: wget python3-protobuf = %{protobuf_ver} %description Open Neural Network Exchange @@ -47,17 +51,7 @@ do sed -i -e 's|#!/usr/bin/env python|#!/usr/bin/python3|' $f done -# requirements -sed -i '/wget/d' requirements.txt - -# libonnx_proto -sed -i '/VISIBILITY_/d' CMakeLists.txt - -# fix protobuf > 3.11 -sed -i 's|dllexport_decl=ONNX_API:||g' CMakeLists.txt - # flags -export ONNX_ML=0 export CMAKE_ARGS="-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_SKIP_RPATH=ON -DCMAKE_VERBOSE_MAKEFILE=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo" %{__python3} setup.py build %{?_smp_mflags} @@ -70,7 +64,6 @@ pushd .setuptools-cmake-build make install DESTDIR=%{buildroot} popd -export ONNX_ML=0 export CMAKE_ARGS="-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_SKIP_RPATH=ON -DCMAKE_VERBOSE_MAKEFILE=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo" %{__python3} setup.py install --root %{buildroot} @@ -80,16 +73,11 @@ sed -i '1 i #!/usr/bin/python3' %{buildroot}/%{python3_sitearch}/onnx/bin/checke mv -f %{buildroot}/%{python3_sitearch}/onnx/bin/checker.py %{buildroot}/%{_bindir}/ sed -i '1 i #!/usr/bin/python3' %{buildroot}/%{python3_sitearch}/onnx/tools/net_drawer.py mv -f %{buildroot}/%{python3_sitearch}/onnx/tools/net_drawer.py %{buildroot}/%{_bindir}/ +mv -f %{buildroot}/%{python3_sitearch}/onnx/tools/replace_constants.py %{buildroot}/%{_bindir}/ +mv -f %{buildroot}/%{python3_sitearch}/onnx/tools/update_model_dims.py %{buildroot}/%{_bindir}/ rm -rf %{buildroot}/%{python3_sitearch}/onnx/bin %{buildroot}/%{python3_sitearch}/onnx/tools chmod +x %{buildroot}/%{_bindir}/* -# remove bogus -rm -rf %{buildroot}/%{python3_sitearch}/onnx/backend/test -#rm -rf %{buildroot}/%{python3_sitearch}/onnx/gen_proto.py -#rm -rf %{buildroot}/%{python3_sitearch}/onnx/__pycache__/gen_proto*.pyc -rm -rf %{buildroot}/%{python3_sitearch}/onnx/defs/gen_doc.py -rm -rf %{buildroot}/%{python3_sitearch}/onnx/defs/__pycache__/gen_doc*.pyc - # remove C & headers from python find %{buildroot}/%{python3_sitearch} -type f -regex '.*\.\(h\|c\|cc\)' -exec rm -rf {} \; for d in `find %{buildroot}/%{python3_sitearch} -type d -empty` @@ -116,6 +104,9 @@ sed -i -e 's|/lib/|/%{_lib}/|g' %{buildroot}/%{_libdir}/cmake/ONNX/ONNXTargets-* %changelog +* Wed Dec 27 2023 Chunmei Xu - 1.14.0-3 +- rebuild with protobuf-3.20.2 + * Mon Dec 25 2023 Chunmei Xu - 1.14.0-2 - fix import error -- Gitee