feat(bazel): enable symbolization (#1116)

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.
This commit is contained in:
Shuai Zhang 2024-08-03 02:38:49 +08:00 committed by Sergiu Deitsch
parent 9ca8073cb2
commit 175b54d4fa
No known key found for this signature in database
2 changed files with 6 additions and 0 deletions

View File

@ -91,12 +91,14 @@ def glog_library(with_gflags = 1, **kwargs):
# Enable declaration of _Unwind_Backtrace # Enable declaration of _Unwind_Backtrace
"-D_GNU_SOURCE", "-D_GNU_SOURCE",
"-DHAVE_LINK_H", "-DHAVE_LINK_H",
"-DHAVE_SYMBOLIZE", # Supported by <link.h>
] ]
linux_only_copts = [ linux_only_copts = [
# For utilities.h. # For utilities.h.
"-DHAVE_EXECINFO_H", "-DHAVE_EXECINFO_H",
"-DHAVE_LINK_H", "-DHAVE_LINK_H",
"-DHAVE_SYMBOLIZE", # Supported by <link.h>
] ]
darwin_only_copts = [ darwin_only_copts = [

View File

@ -77,6 +77,10 @@
# error "symbolize.h" was not included correctly. # error "symbolize.h" was not included correctly.
#endif #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 GLOG_NO_SYMBOLIZE_DETECTION
# ifndef HAVE_SYMBOLIZE # ifndef HAVE_SYMBOLIZE
// defined by gcc // defined by gcc