From e81ab9bc2ce7503d97413cc82d08548144b6193b Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 6 May 2022 15:59:34 +0100 Subject: [PATCH] Silence some protobuf link warnings 4 warnings remain but it's better than before --- contrib/depends/packages/protobuf.mk | 5 + .../depends/patches/protobuf/visibility.patch | 159 ++++++++++++++++++ 2 files changed, 164 insertions(+) create mode 100644 contrib/depends/patches/protobuf/visibility.patch diff --git a/contrib/depends/packages/protobuf.mk b/contrib/depends/packages/protobuf.mk index ad1098975..ddec1eb59 100644 --- a/contrib/depends/packages/protobuf.mk +++ b/contrib/depends/packages/protobuf.mk @@ -5,12 +5,17 @@ $(package)_file_name=$(native_$(package)_file_name) $(package)_sha256_hash=$(native_$(package)_sha256_hash) $(package)_dependencies=native_$(package) $(package)_cxxflags=-std=c++11 +$(package)_patches=visibility.patch define $(package)_set_vars $(package)_config_opts=--disable-shared --with-protoc=$(build_prefix)/bin/protoc $(package)_config_opts_linux=--with-pic endef +define $(package)_preprocess_cmds + patch -p0 < $($(package)_patch_dir)/visibility.patch +endef + define $(package)_config_cmds $($(package)_autoconf) AR_FLAGS=$($(package)_arflags) endef diff --git a/contrib/depends/patches/protobuf/visibility.patch b/contrib/depends/patches/protobuf/visibility.patch new file mode 100644 index 000000000..e66d5961f --- /dev/null +++ b/contrib/depends/patches/protobuf/visibility.patch @@ -0,0 +1,159 @@ +--- src/google/protobuf/descriptor.cc.O 2018-07-30 22:16:10.000000000 +0000 ++++ src/google/protobuf/descriptor.cc 2022-05-06 13:38:14.827309092 +0000 +@@ -32,6 +32,9 @@ + // Based on original Protocol Buffers design by + // Sanjay Ghemawat, Jeff Dean, and others. + ++#if defined(__APPLE__) && defined(__arm64__) ++#pragma GCC visibility push(hidden) ++#endif + #include + #include + #include +@@ -7274,3 +7277,6 @@ + + } // namespace protobuf + } // namespace google ++#if defined(__APPLE__) && defined(__arm64__) ++#pragma GCC visibility pop ++#endif +--- src/google/protobuf/extension_set.cc.O 2018-07-23 20:56:42.000000000 +0000 ++++ src/google/protobuf/extension_set.cc 2022-05-06 14:48:55.369877050 +0000 +@@ -32,6 +32,9 @@ + // Based on original Protocol Buffers design by + // Sanjay Ghemawat, Jeff Dean, and others. + ++#if defined(__APPLE__) && defined(__arm64__) ++#pragma GCC visibility push(hidden) ++#endif + #include + #include + #include +@@ -1914,3 +1917,6 @@ + } // namespace internal + } // namespace protobuf + } // namespace google ++#if defined(__APPLE__) && defined(__arm64__) ++#pragma GCC visibility pop ++#endif +--- src/google/protobuf/extension_set_heavy.cc.O 2018-07-30 22:16:10.000000000 +0000 ++++ src/google/protobuf/extension_set_heavy.cc 2022-05-06 14:14:27.847320946 +0000 +@@ -35,6 +35,10 @@ + // Contains methods defined in extension_set.h which cannot be part of the + // lite library because they use descriptors or reflection. + ++#if defined(__APPLE__) && defined(__arm64__) ++#pragma GCC visibility push(hidden) ++#endif ++ + #include + #include + #include +@@ -814,3 +818,6 @@ + } // namespace internal + } // namespace protobuf + } // namespace google ++#if defined(__APPLE__) && defined(__arm64__) ++#pragma GCC visibility pop ++#endif +--- src/google/protobuf/generated_message_reflection.cc.O 2018-07-23 20:56:42.000000000 +0000 ++++ src/google/protobuf/generated_message_reflection.cc 2022-05-06 13:38:49.655540772 +0000 +@@ -32,6 +32,9 @@ + // Based on original Protocol Buffers design by + // Sanjay Ghemawat, Jeff Dean, and others. + ++#if defined(__APPLE__) && defined(__arm64__) ++#pragma GCC visibility push(hidden) ++#endif + #include + #include + +@@ -2420,3 +2423,6 @@ + } // namespace internal + } // namespace protobuf + } // namespace google ++#if defined(__APPLE__) && defined(__arm64__) ++#pragma GCC visibility pop ++#endif +--- src/google/protobuf/map_field.cc.O 2018-07-23 20:56:42.000000000 +0000 ++++ src/google/protobuf/map_field.cc 2022-05-06 13:34:44.913905697 +0000 +@@ -28,6 +28,10 @@ + // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ++#if defined(__APPLE__) && defined(__arm64__) ++#pragma GCC visibility push(hidden) ++#endif ++ + #include + #include + +@@ -462,3 +466,6 @@ + } // namespace internal + } // namespace protobuf + } // namespace google ++#if defined(__APPLE__) && defined(__arm64__) ++#pragma GCC visibility pop ++#endif +--- src/google/protobuf/text_format.cc.O 2018-07-30 22:16:11.000000000 +0000 ++++ src/google/protobuf/text_format.cc 2022-05-06 13:34:58.881999517 +0000 +@@ -32,6 +32,10 @@ + // Based on original Protocol Buffers design by + // Sanjay Ghemawat, Jeff Dean, and others. + ++#if defined(__APPLE__) && defined(__arm64__) ++#pragma GCC visibility push(hidden) ++#endif ++ + #include + #include + #include +@@ -2258,3 +2262,6 @@ + + } // namespace protobuf + } // namespace google ++#if defined(__APPLE__) && defined(__arm64__) ++#pragma GCC visibility pop ++#endif +--- src/google/protobuf/wire_format.cc.O 2018-07-23 20:56:42.000000000 +0000 ++++ src/google/protobuf/wire_format.cc 2022-05-06 13:06:23.294219228 +0000 +@@ -32,6 +32,10 @@ + // Based on original Protocol Buffers design by + // Sanjay Ghemawat, Jeff Dean, and others. + ++#if defined(__APPLE__) && defined(__arm64__) ++#pragma GCC visibility push(hidden) ++#endif ++ + #include + #include + #include +@@ -1445,3 +1449,7 @@ + } // namespace internal + } // namespace protobuf + } // namespace google ++ ++#if defined(__APPLE__) && defined(__arm64__) ++#pragma GCC visibility pop ++#endif +--- src/google/protobuf/stubs/status.cc.O 2018-07-23 20:56:42.000000000 +0000 ++++ src/google/protobuf/stubs/status.cc 2022-05-06 15:18:53.393208814 +0000 +@@ -27,6 +27,11 @@ + // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++#if defined(__APPLE__) && defined(__arm64__) ++#pragma GCC visibility push(hidden) ++#endif ++ + #include + + #include +@@ -132,3 +137,6 @@ + } // namespace util + } // namespace protobuf + } // namespace google ++#if defined(__APPLE__) && defined(__arm64__) ++#pragma GCC visibility pop ++#endif