From 3e90a4ab3f506723f1ea58f1ccfa6fdd16edd4dd Mon Sep 17 00:00:00 2001 From: Teju Nareddy Date: Thu, 29 Oct 2020 10:50:50 -0400 Subject: [PATCH] [espv2] Fix build failures due to OOM (#4569) * [espv2] Fix build failures due to OOM ESPv2 builds have been failing with OOM since we updated our envoy dependency. Signed-off-by: Teju Nareddy * Fix ubsan and coverage builds Only use `--copt -D__SANITIZE_ADDRESS__` for `address` builds Signed-off-by: Teju Nareddy * Remove another copt Signed-off-by: Teju Nareddy * Fix spawn strategy, unsure why it causes build failure Signed-off-by: Teju Nareddy --- projects/esp-v2/build.sh | 11 +++++++++-- projects/esp-v2/project.yaml | 3 +-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/projects/esp-v2/build.sh b/projects/esp-v2/build.sh index 8a214e166..4206b30fe 100755 --- a/projects/esp-v2/build.sh +++ b/projects/esp-v2/build.sh @@ -15,7 +15,7 @@ # ################################################################################ -## Copied from esp-v2 +## Copied from envoy export CFLAGS="$CFLAGS" export CXXFLAGS="$CXXFLAGS" @@ -37,11 +37,15 @@ done for f in ${CXXFLAGS}; do echo "--cxxopt=${f}" "--linkopt=${f}" done + if [ "$SANITIZER" = "undefined" ] then # Bazel uses clang to link binary, which does not link clang_rt ubsan library for C++ automatically. # See issue: https://github.com/bazelbuild/bazel/issues/8777 echo "--linkopt=\"$(find $(llvm-config --libdir) -name libclang_rt.ubsan_standalone_cxx-x86_64.a | head -1)\"" +elif [ "$SANITIZER" = "address" ] +then + echo "--copt -D__SANITIZE_ADDRESS__" "--copt -DADDRESS_SANITIZER=1" fi )" @@ -62,11 +66,14 @@ do done # Build driverless libraries. +# Benchmark about 3 GB per CPU (10 threads for 28.8 GB RAM) +# TODO(nareddyt): Remove deprecation warnings when Envoy and deps moves to C++17 bazel build --verbose_failures --dynamic_mode=off --spawn_strategy=sandboxed \ + --local_cpu_resources=HOST_CPUS*0.32 \ --genrule_strategy=standalone --strip=never \ --copt=-fno-sanitize=vptr --linkopt=-fno-sanitize=vptr \ --define tcmalloc=disabled --define signal_trace=disabled \ - --define ENVOY_CONFIG_ASAN=1 --copt -D__SANITIZE_ADDRESS__ \ + --define ENVOY_CONFIG_ASAN=1 \ --define force_libcpp=enabled --build_tag_filters=-no_asan \ --linkopt=-lc++ --linkopt=-pthread ${EXTRA_BAZEL_FLAGS} \ ${BAZEL_BUILD_TARGETS[*]} ${BAZEL_CORPUS_TARGETS[*]} diff --git a/projects/esp-v2/project.yaml b/projects/esp-v2/project.yaml index 7621f48e0..330087a10 100644 --- a/projects/esp-v2/project.yaml +++ b/projects/esp-v2/project.yaml @@ -1,8 +1,7 @@ homepage: "https://github.com/GoogleCloudPlatform/esp-v2" language: c++ -primary_contact: "jilinxia@google.com" +primary_contact: "nareddyt@google.com" auto_ccs: -- "nareddyt@google.com" - "taoxuy@google.com" - "qiwzhang@google.com" sanitizers: