From d7764fba81335d97234660f769e11484cf981080 Mon Sep 17 00:00:00 2001 From: jmillikin-stripe Date: Tue, 27 Feb 2018 13:20:28 -0800 Subject: [PATCH] In the Envoy build, use `$CXXFLAGS` only for C++ sources. (#1199) --- projects/envoy/build.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/projects/envoy/build.sh b/projects/envoy/build.sh index 1358f54c5..eac28d994 100755 --- a/projects/envoy/build.sh +++ b/projects/envoy/build.sh @@ -30,8 +30,22 @@ FUZZER_DICTIONARIES="\ export DISABLE_GPERFTOOLS_BUILD=1 sed -i 's#envoy_dependencies()#envoy_dependencies(skip_targets=["tcmalloc_and_profiler"])#' WORKSPACE +# Copy $CFLAGS and $CXXFLAGS into Bazel command-line flags, for both +# compilation and linking. +# +# Some flags, such as `-stdlib=libc++`, generate warnings if used on a C source +# file. Since the build runs with `-Werror` this will cause it to break, so we +# use `--conlyopt` and `--cxxopt` instead of `--copt`. +declare -r EXTRA_BAZEL_FLAGS="$( +for f in ${CFLAGS}; do + echo "--conlyopt=${f}" "--linkopt=${f}" +done +for f in ${CXXFLAGS}; do + echo "--cxxopt=${f}" "--linkopt=${f}" +done +)" + # Build Envoy -declare -r EXTRA_BAZEL_FLAGS="$(for f in ${CXXFLAGS}; do echo --copt=$f --linkopt=$f; done)" declare -r BAZEL_BUILD_TARGETS="$(for t in ${FUZZER_TARGETS}; do echo //"$t"_driverless; done)" bazel build --verbose_failures --dynamic_mode=off --spawn_strategy=standalone \ --genrule_strategy=standalone --strip=never \