[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 <nareddyt@google.com>

* Fix ubsan and coverage builds

Only use `--copt -D__SANITIZE_ADDRESS__` for `address` builds

Signed-off-by: Teju Nareddy <nareddyt@google.com>

* Remove another copt

Signed-off-by: Teju Nareddy <nareddyt@google.com>

* Fix spawn strategy, unsure why it causes build failure

Signed-off-by: Teju Nareddy <nareddyt@google.com>
This commit is contained in:
Teju Nareddy 2020-10-29 10:50:50 -04:00 committed by GitHub
parent 0c8e9162eb
commit 3e90a4ab3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -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[*]}

View File

@ -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: