From ecd5d2bbf1a0d40077c3ce4fcf431d0018ab7e50 Mon Sep 17 00:00:00 2001 From: wangxiaochao Date: Thu, 24 Mar 2022 10:32:00 +0800 Subject: [PATCH] Make libprotobuf symbols local on OSX Signed-off-by: wangxiaochao --- ...ake-libprotobuf-symbols-local-on-OSX.patch | 52 +++++++++++++++++++ protobuf.spec | 9 +++- 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 0004-Make-libprotobuf-symbols-local-on-OSX.patch diff --git a/0004-Make-libprotobuf-symbols-local-on-OSX.patch b/0004-Make-libprotobuf-symbols-local-on-OSX.patch new file mode 100644 index 0000000..a068312 --- /dev/null +++ b/0004-Make-libprotobuf-symbols-local-on-OSX.patch @@ -0,0 +1,52 @@ +From 6506a260cde48e0f8434d0926b927aa50972d36a Mon Sep 17 00:00:00 2001 +From: wangxiaochao +Date: Thu, 24 Mar 2022 09:58:10 +0800 +Subject: [PATCH] Make libprotobuf symbols local on OSX + +Signed-off-by: wangxiaochao +--- + python/setup.py | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/python/setup.py b/python/setup.py +index d003c96..f888734 100755 +--- a/python/setup.py ++++ b/python/setup.py +@@ -192,6 +192,18 @@ if __name__ == '__main__': + + extra_compile_args = [] + ++ message_extra_link_args = None ++ api_implementation_link_args = None ++ if "darwin" in sys.platform: ++ if sys.version_info[0] == 2: ++ message_init_symbol = 'init_message' ++ api_implementation_init_symbol = 'init_api_implementation' ++ else: ++ message_init_symbol = 'PyInit__message' ++ api_implementation_init_symbol = 'PyInit__api_implementation' ++ message_extra_link_args = ['-Wl,-exported_symbol,_%s' % message_init_symbol] ++ api_implementation_link_args = ['-Wl,-exported_symbol,_%s' % api_implementation_init_symbol] ++ + if sys.platform != 'win32': + extra_compile_args.append('-Wno-write-strings') + extra_compile_args.append('-Wno-invalid-offsetof') +@@ -242,6 +254,7 @@ if __name__ == '__main__': + include_dirs=[".", "../src"], + libraries=libraries, + extra_objects=extra_objects, ++ extra_link_args=message_extra_link_args, + library_dirs=['../src/.libs'], + extra_compile_args=extra_compile_args, + ), +@@ -249,6 +262,7 @@ if __name__ == '__main__': + "google.protobuf.internal._api_implementation", + glob.glob('google/protobuf/internal/api_implementation.cc'), + extra_compile_args=extra_compile_args + ['-DPYTHON_PROTO2_CPP_IMPL_V2'], ++ extra_link_args=api_implementation_link_args, + ), + ]) + os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'cpp' +-- +2.30.0 + diff --git a/protobuf.spec b/protobuf.spec index b3e133f..88b2624 100644 --- a/protobuf.spec +++ b/protobuf.spec @@ -8,7 +8,7 @@ Summary: Protocol Buffers - Google's data interchange format Name: protobuf Version: 3.14.0 -Release: 3 +Release: 4 License: BSD URL: https://github.com/protocolbuffers/protobuf Source: https://github.com/protocolbuffers/protobuf/releases/download/v%{version}%{?rcver}/%{name}-all-%{version}%{?rcver}.tar.gz @@ -17,6 +17,7 @@ Source1: protobuf-init.el Patch9000: 0001-add-secure-compile-option-in-Makefile.patch Patch9001: 0002-add-secure-compile-fs-check-in-Makefile.patch Patch9002: 0003-fix-CVE-2021-22570.patch +Patch9003: 0004-Make-libprotobuf-symbols-local-on-OSX.patch BuildRequires: make autoconf automake emacs gcc-c++ libtool pkgconfig zlib-devel %description @@ -319,6 +320,12 @@ install -p -m 0644 %{SOURCE1} %{buildroot}%{_emacs_sitestartdir} %endif %changelog +* Thu Mar 24 2022 wangxiaochao - 3.14.0-4 +- Type:buxfix +- ID:NA +- SUG:NA +- DESC: fix python process will crash while useing multiple versions of protobuf + * Fri Mar 18 2022 wangxiaochao - 3.14.0-3 - Type:buxfix - ID:NA -- Gitee