From f0f7d3ceffa0be6c20eb6a4e10c1856348aa3982 Mon Sep 17 00:00:00 2001 From: Shuai Zhang Date: Wed, 31 Jul 2024 09:50:26 +0800 Subject: [PATCH] feat(bazel): enable symbolization Symbolization support on Linux and BSD requires link.h which is usually provided by the GNU C Library (glibc). Assume the header to be present at all times by unconditionally defining HAVE_SYMBOLIZE on the corresponding platforms. --- bazel/glog.bzl | 2 ++ src/symbolize.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/bazel/glog.bzl b/bazel/glog.bzl index 286346b3a..ff54e2420 100644 --- a/bazel/glog.bzl +++ b/bazel/glog.bzl @@ -91,12 +91,14 @@ def glog_library(with_gflags = 1, **kwargs): # Enable declaration of _Unwind_Backtrace "-D_GNU_SOURCE", "-DHAVE_LINK_H", + "-DHAVE_SYMBOLIZE", # Supported by ] linux_only_copts = [ # For utilities.h. "-DHAVE_EXECINFO_H", "-DHAVE_LINK_H", + "-DHAVE_SYMBOLIZE", # Supported by ] darwin_only_copts = [ diff --git a/src/symbolize.h b/src/symbolize.h index d9ca52ddc..9eb5de40f 100644 --- a/src/symbolize.h +++ b/src/symbolize.h @@ -77,6 +77,10 @@ # error "symbolize.h" was not included correctly. #endif +// We prefer to let the build system detect the availability of certain features +// such as symbolization support. HAVE_SYMBOLIZE should therefore be defined by +// the build system in general unless there is a good reason to perform the +// detection using the preprocessor. #ifndef GLOG_NO_SYMBOLIZE_DETECTION # ifndef HAVE_SYMBOLIZE // defined by gcc