From a5e5e94904aa60100b802c15f08b50f7ddb92586 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Mon, 8 Jun 2020 11:13:34 -0700 Subject: [PATCH] Avoid linkstatic on macOS, see https://github.com/bazelbuild/bazel/issues/11552. PiperOrigin-RevId: 315313209 Change-Id: I5d86e271b7733cf16d9b8de98d1c2ee69764608f --- third_party/clog/BUILD.bazel | 19 ++++++++++++++++++- third_party/cpuinfo/BUILD.bazel | 6 +++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/third_party/clog/BUILD.bazel b/third_party/clog/BUILD.bazel index ee601b85f2b..e1d59304299 100644 --- a/third_party/clog/BUILD.bazel +++ b/third_party/clog/BUILD.bazel @@ -19,11 +19,20 @@ cc_library( ":windows": [], "//conditions:default": ["-Wno-unused-result"], }), + defines = select({ + # When linkstatic=False, we need default visibility + ":macos_x86_64": ["CLOG_VISIBILITY="], + "//conditions:default": [], + }), linkopts = select({ ":android": ["-llog"], "//conditions:default": [], }), - linkstatic = True, + linkstatic = select({ + # https://github.com/bazelbuild/bazel/issues/11552 + ":macos_x86_64": False, + "//conditions:default": True, + }), strip_include_prefix = "deps/clog/include", ) @@ -36,3 +45,11 @@ config_setting( name = "windows", values = {"cpu": "x64_windows"}, ) + +config_setting( + name = "macos_x86_64", + values = { + "apple_platform_type": "macos", + "cpu": "darwin", + }, +) diff --git a/third_party/cpuinfo/BUILD.bazel b/third_party/cpuinfo/BUILD.bazel index 2a2be96d82f..c2c6381950f 100644 --- a/third_party/cpuinfo/BUILD.bazel +++ b/third_party/cpuinfo/BUILD.bazel @@ -125,7 +125,11 @@ cc_library( "-Iexternal/cpuinfo/include", "-Iexternal/cpuinfo/src", ], - linkstatic = True, + linkstatic = select({ + # https://github.com/bazelbuild/bazel/issues/11552 + ":macos_x86_64": False, + "//conditions:default": True, + }), # Headers must be in textual_hdrs to allow us to set the standard to C99 textual_hdrs = [ "include/cpuinfo.h",