-
Notifications
You must be signed in to change notification settings - Fork 249
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
Different linkers/flags used in cmake
's generate and build steps.
#863
Comments
This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_foreign_cc! |
This issue was automatically closed because it went 30 days without a reply since it was labeled "Can Close?" |
I had to resort to compiling with bazel option
to get a successful build in my case. Without it, the linking command failed with
which apparently is caused by the combination of LTO and lld linker with gcc, as in |
This is a regression when using
rules_foreign_cc
with Bazel v5.0.0 (which for some reason useslld
in the generate step), and it works fine with Bazel v4.2.2 (which usesld.gold
in the generate step). FYI, @Wyverald.However, the underlying issue seems to be with different flags being passed to generate and build steps in the
cmake
rule.Possibly related? #235
Background
We've ran into this issue back in 2019, and we've been carrying a patch in Envoy that removes the check for the problematic flag (
-Wl,--color-diagnostics
) when building LLVM usingrules_foreign_cc
.However, we've been building LLVM using
rules_foreign_cc
(using the same rules) without the patch in Proxy-Wasm C++ Host since early 2020, using various Bazel versions (v3.6.0 to v4.2.2).Bazel v4.2.2
The generate step doesn't detect support for
-Wl,--color-diagnostics
inld.gold
:The build step succeeds:
Note that the generate step was using
-fuse-ld=/usr/bin/ld.gold
, but there is no-fuse-ld
option in the build step.Bazel v5.0.0
The generate step detects support for
-Wl,--color-diagnostics
inlld
:The build step fails:
Note that the generate step was using
-fuse-ld=/usr/lib/llvm-12/bin/ld.lld
, but there is no-fuse-ld
option in the build step.Note that there is no
-fuse-ld
flag passed anywhere in the Bazel workspace, so I'm not sure why it selectslld
.Also, the issue persist even when using
CC=gcc-11
CXX=g++-11
, but then-fuse-ld=lld
is used in the generate step.Reproduce steps
The easiest way to reproduce this is to checkout my Proxy-Wasm C++ Host fork:
$ git clone https://github.com/PiotrSikora/proxy-wasm-cpp-host $ cd proxy-wasm-cpp-host
Note that it currently uses
rules_foreign_cc
v0.2.0, but I also tested with the latest commit (50ee9979e60e8db38e10de45d2c60873a210bf55
) and it makes no difference.Checkout
master
with Bazel v4.2.2:Checkout PR with Bazel v5.0.0:
Note: use
generate_args = ["-GNinja", "--trace-expand"]
andbuild_args = ["--verbose"]
to see all the commands.The text was updated successfully, but these errors were encountered: