diff --git a/bazel/envoy_build_system.bzl b/bazel/envoy_build_system.bzl index 639519ddd4215..17586d55edf56 100644 --- a/bazel/envoy_build_system.bzl +++ b/bazel/envoy_build_system.bzl @@ -24,6 +24,10 @@ def envoy_copts(repository, test = False): }) + select({ repository + "//bazel:disable_signal_trace": [], "//conditions:default": ["-DENVOY_HANDLE_SIGNALS"], + }) + select({ + # TCLAP command line parser needs this to support int64_t/uint64_t + "@bazel_tools//tools/osx:darwin": ["-DHAVE_LONG_LONG"], + "//conditions:default": [], }) # Compute the final linkopts based on various options. diff --git a/source/common/runtime/runtime_impl.cc b/source/common/runtime/runtime_impl.cc index 924b884a06e1c..39348ab832a1d 100644 --- a/source/common/runtime/runtime_impl.cc +++ b/source/common/runtime/runtime_impl.cc @@ -3,6 +3,10 @@ #include #include +#ifdef __APPLE__ +#include +#endif + #include #include #include @@ -22,6 +26,15 @@ namespace Runtime { const size_t RandomGeneratorImpl::UUID_LENGTH = 36; std::string RandomGeneratorImpl::uuid() { +#ifdef __APPLE__ + // TODO(zuercher): factor out a sensible interface for UUID generation to make it easier + // to put a faster implementation in later. + char generated_uuid[UUID_LENGTH + 1]; + uuid_t uuid; + uuid_generate_random(uuid); + uuid_unparse(uuid, generated_uuid); + return std::string(generated_uuid); +#else int fd = open("/proc/sys/kernel/random/uuid", O_RDONLY); if (-1 == fd) { throw EnvoyException(fmt::format("unable to open uuid, errno: {}", strerror(errno))); @@ -38,6 +51,7 @@ std::string RandomGeneratorImpl::uuid() { } return std::string(generated_uuid); +#endif } SnapshotImpl::SnapshotImpl(const std::string& root_path, const std::string& override_path, diff --git a/source/server/server.cc b/source/server/server.cc index d3e3cc2f00bef..1b32be46787fe 100644 --- a/source/server/server.cc +++ b/source/server/server.cc @@ -61,6 +61,7 @@ InstanceImpl::InstanceImpl(Options& options, TestHooks& hooks, HotRestart& resta } catch (const EnvoyException& e) { ENVOY_LOG(critical, "error initializing configuration '{}': {}", options.configPath(), e.what()); + thread_local_.shutdownGlobalThreading(); thread_local_.shutdownThread(); exit(1); }