-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
build: remove cc_configure and cc_wrapper #7555
Conversation
Signed-off-by: Lizan Zhou <[email protected]>
@@ -8,6 +8,8 @@ startup --host_jvm_args=-Xmx512m | |||
build --workspace_status_command=bazel/get_workspace_status | |||
build --experimental_remap_main_repo | |||
build --host_force_python=PY2 | |||
build --action_env=BAZEL_LINKLIBS=-l%:libstdc++.a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What effect does this have on macOS or Windows builds? Is there any way to set it only on Linux?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my read of https://github.com/bazelbuild/bazel/tree/0.28.0/tools/cpp this env doesn't have any effect on configure_osx_toolchain
or configure_windows_toolchain
so it should be no-op.
Signed-off-by: Lizan Zhou <[email protected]>
Signed-off-by: Lizan Zhou <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Lizan Zhou <[email protected]>
# it in clang builds causes a build error because of unknown command line | ||
# flag. | ||
# See https://github.com/envoyproxy/envoy/issues/2987 | ||
argv.append("-Wno-maybe-uninitialized") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In principle, this PR is really great, it will hugely simplify build. One downside is we lose an interception point to workaround Bazel issues, but I guess we can always introduce it again later. Beyond libc++
handling, it looks like this line is something that we were using cc_wrapper
for previously, what happens to this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my TODO above:
migrate compiler options to envoy_copts with select
will update for this and make it ready for review.
@htuch this is ready to review, PTAL again |
@@ -210,6 +210,7 @@ TEST_P(ClusterMemoryTestRunner, MemoryLargeClusterSizeWithStats) { | |||
// 2019/06/29 7364 45685 46000 combine 2 levels of stat ref-counting into 1 | |||
// 2019/06/30 7428 42742 43000 remove stats multiple inheritance, inline HeapStatData | |||
// 2019/07/06 7477 42742 43000 fork gauge representation to drop pending_increment_ | |||
// 2019/07/15 7555 42806 43000 static link libstdc++ in tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did test behavior change in the PR? I thought we were just removing wrappers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes how we link libstdc++ in tests, previously, libstdc++ is dynamically linked for tests as envoy_static_link_libstdcpp_linkopts
isn't added to envoy_cc_test
linkopts. With this PR tests are linked with libstdc++ too so the number changed. Current master with following patch produces same number:
diff --git a/bazel/envoy_test.bzl b/bazel/envoy_test.bzl
index ea564d619..c502fa007 100644
--- a/bazel/envoy_test.bzl
+++ b/bazel/envoy_test.bzl
@@ -150,7 +150,7 @@ def envoy_cc_test(
native.cc_test(
name = name,
copts = envoy_copts(repository, test = True) + copts,
- linkopts = _envoy_test_linkopts(),
+ linkopts = _envoy_test_linkopts() + envoy_static_link_libstdcpp_linkopts(),
linkstatic = envoy_linkstatic(),
malloc = tcmalloc_external_dep(repository),
deps = [
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to do this at the same time as this PR? If so, please update the top-level GH comment so we can also explain that this is happening.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes because BAZEL_LINKLIBS is toolchain configuration so applies to all binary. Updated description.
Signed-off-by: Lizan Zhou <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This seems to break
There might be some other silent failures, due to optional features that can no longer be detected. @lizan any ideas? |
@PiotrSikora hmm, not sure why #7329 didn't break this, cc_wrapper -std=c++11 atomic.cc broke too. This patch seems work, you're only using static libraries from LLVM so should be no-op to that:
|
Signed-off-by: Lizan Zhou <[email protected]>
Signed-off-by: Lizan Zhou <[email protected]>
Signed-off-by: Lizan Zhou [email protected]
Description:
Use
BAZEL_LINKLIBS
to statically link libstdc++ and libc++, get rid ofcc_wrapper
. Requires Bazel >= 0.28. Additional compiler options which was in cc_wrapeer moved into envoy_copts withselect
.Side effect: static linking libstdc++ applies to all binaries built with the toolchain, so tests are now statically linked with libstdc++.
Risk Level: Med, affecting depending projects
Testing: CI
Docs Changes: N/A
Release Notes: N/A