Fix stacktrace on bazel build. (#347)

We need at least following defs to be set to print stacktrace in
failure signal handler.

- HAVE_UNWIND_H: on Linux and macOS. unwind.h is usually present
  by default on those OSes.
- HAVE_DLADDR: on macOS.

Windows is not cared because glog can not be built with bazel
on Windows today.
This commit is contained in:
Shuhei Takahashi 2019-04-12 10:09:41 +09:00 committed by Fumitoshi Ukai
parent 96a2f23dca
commit 6ca3d3cf58

View File

@ -73,7 +73,16 @@ def glog_library(namespace='google', with_gflags=1, **kwargs):
# Include generated header files.
'-I%s/glog_internal' % gendir,
] + ([
] + select({
# For stacktrace.
'@bazel_tools//src/conditions:darwin': [
'-DHAVE_UNWIND_H',
'-DHAVE_DLADDR',
],
'//conditions:default': [
'-DHAVE_UNWIND_H',
],
}) + ([
# Use gflags to parse CLI arguments.
'-DHAVE_LIB_GFLAGS',
] if with_gflags else []),