-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
When linking mostly-static Linux binaries, link libstdc++.a explicitly. #4031
When linking mostly-static Linux binaries, link libstdc++.a explicitly. #4031
Conversation
Can one of the admins verify this patch? |
Did you test this patch? Does it solve your problems? I'm asking because you fixed only the static crosstool that bazel uses to bootstrap itself (and for some tests I think), not the crosstool that is used for user builds (that one is generated by tools/cpp/cc_configure.bzl from tools/cpp/crosstool.tpl), and that doesn't sound like what I assumed you wanted to do. |
b2bfb3f
to
ffe40ea
Compare
@mhlopko I tested by editing the Envoy CROSSTOOL to save time, but I guess that wasn't a good idea. Patch updated to edit Output of
|
Ping? Anything else I should be doing here? |
Sorry for the silence. It's looking good, could you write a test for this since I'll be refactoring crosstools soon-ish so I don't break this again accidentally? Get some inspiration from cpp_darwin_integration_test.sh to get a platform specific test setup. Thanks! |
ffe40ea
to
1fcf5f2
Compare
This allows libstdc++ to be statically linked, which is normally only possible when invoking GCC as `g++` with the `-static-libstdc++` flag. Fixes bazelbuild#2840 See envoyproxy/envoy#415 for additional background and context.
1fcf5f2
to
71d921c
Compare
OK, test added. |
@mhlopko Can we merge this now? |
Waiting for @dslomov review. |
Gentle ping, again. The holidays are coming up so if this doesn't get merged in soon then I might not be able to respond to comments until January. |
Thanks! I notice 0.9 already has a baseline. Marcel, Dmitry, could this CL please get cherrypicked into the 0.9 release? |
I'm afraid we cannot pick new features into the existing release, only fixes for regressions are allowed (https://blog.bazel.build/2017/09/27/release-cadence.html). I'm sorry it took me so long to review the pull request. |
…togenerated cc toolchain Relevant to #4031, fixes #4524. Does not affect the osx + xcode toolchain that supports both C++ and ObjC! RELNOTES: BAZEL_LINKOPTS is now consulted when autoconfiguring c++ toolchain Now linker flags for the autogenerated C++ toolchain can be controlled by BAZEL_LINKOPTS environment variable (using colon as a flag separator): BAZEL_LINKOPTS=-lc++ bazel build //... The default value is "-lstdc++:-lm". PiperOrigin-RevId: 187173297
This allows libstdc++ to be statically linked, which is normally only
possible when invoking GCC as
g++
with the-static-libstdc++
flag.Fixes #2840
See envoyproxy/envoy#415 for additional
background and context.
cc @htuch (for Envoy) and @calpeyser @hlopko (who I talked to earlier about this)
I'm only doing this in the Linux toolchain because MacOS doesn't do static linking of system libs anyway, and I don't know enough about Windows or FreeBSD to test on those platforms.