Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bazel: similar build flags to cmake for corresponding build types (#4… #720

Merged
merged 10 commits into from
Apr 17, 2017
15 changes: 15 additions & 0 deletions bazel/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
package(default_visibility = ["//visibility:public"])

exports_files(["gen_sh_test_runner.sh"])

config_setting(
name = "opt_build",
values = {"compilation_mode": "opt"},
)

config_setting(
name = "fastbuild_build",
values = {"compilation_mode": "fastbuild"},
)

config_setting(
name = "dbg_build",
values = {"compilation_mode": "dbg"},
)
19 changes: 9 additions & 10 deletions bazel/envoy_build_system.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,19 @@ load("@protobuf_git//:protobuf.bzl", "cc_proto_library")
ENVOY_COPTS = [
# TODO(htuch): Remove this when Bazel bringup is done.
"-DBAZEL_BRINGUP",
"-fno-omit-frame-pointer",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this default in bazel?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep.

# TODO(htuch): Clang wants -ferror-limit, should support both. Commented out for now.
# "-fmax-errors=3",
"-Wall",
# TODO(htuch): Figure out why protobuf-3.2.0 causes the CI build to fail
# with this but not the developer-local build.
#"-Wextra",
"-Wextra",
"-Werror",
"-Wnon-virtual-dtor",
"-Woverloaded-virtual",
# TODO(htuch): Figure out how to use this in the presence of headers in
# openssl/tclap which use old style casts.
# "-Wold-style-cast",
"-Wold-style-cast",
"-std=c++0x",
"-includeprecompiled/precompiled.h",
]
] + select({
"//bazel:opt_build": [],
Copy link
Member

@mattklein123 mattklein123 Apr 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-DNDEBUG? Still need debug symbols?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bazel automatically sets NDEBUG in opt, see the output in the above commit messages. We're now actually in a strange situation where Bazel is setting NDEBUG in opt and we set DEBUG in fastbuild/dbg. Shouldn't we just have one define indicating debug and use the negated logic where necessary?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think DEBUG is just habit from previous jobs. I don't think we use it anywhere and I agree it's silly. Let's just kill it. Can you grep for it though just to make sure we don't use it anywhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed it's not used, switching to NDEBUG only.

"//bazel:fastbuild_build": ["-DDEBUG"],
"//bazel:dbg_build": ["-ggdb3", "-DDEBUG"],
})

# References to Envoy external dependencies should be wrapped with this function.
def envoy_external_dep_path(dep):
Expand Down Expand Up @@ -70,6 +67,8 @@ def envoy_cc_binary(name,
linkopts = [
"-pthread",
"-lrt",
"-static-libstdc++",
"-static-libgcc",
],
linkstatic = 1,
visibility = visibility,
Expand Down
2 changes: 1 addition & 1 deletion ci/ci_steps.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
ENVOY_BUILD_SHA=b05ce8efcc0ba7957ad6724da83b1ae2abee4600
ENVOY_BUILD_SHA=3d878d55e05a554514305f26101bd6ad15a4a602

# Script that lists all the steps take by the CI system when doing Envoy builds.
set -e
Expand Down