-
Notifications
You must be signed in to change notification settings - Fork 529
Set ARFLAGS in the cargo_build_script rule #3704
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
Conversation
553c3f0 to
e0e5ddc
Compare
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.
Seems reasonable to me! Would you also be able to add some sort of regression test to //test/cargo_build_script/...? I would love to know the plumbing of AR args continues to work.
edit: Also, thank you!
|
Looks like the macOS failure is very relevant; the configured toolchain's |
Hmm... or not. Looks like it's failing on other builds too. Test log contents: |
There were two issues with AR in the cargo_build_script rule: 1. ARFLAGS was not set. 2. For many toolchains, the ar tool was not properly configured. This change fixes both of those problems.
c9aee18 to
dc09d91
Compare
|
Hmm, TL;DR: cc-rs does not properly support |
|
I'd much rather emit an error if I'll try to add |
|
Ping :) |
UebelAndre
left a comment
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.
Thank you!
This is a partial revert of bazelbuild#3704. It does NOT revert logic that properly finds the hermetic archiver (binary and associated tests). cc-rs needs full ownership of flag handling for the archiver. This is in part due to `ar` having very specific positional flag behaviors, and partially due to some special logic in how cc-rs constructs static libraries. The change to enable ARFLAGS was causing many toolchains that pass flags to the static archiver to error out due to conflicting expectations for flag handling. Example bad ar invocation, where `cq` is treated as the destination archive instead of the `ar` tool mode: ar rcsD cq dest.a src1.o src2.o This drops forwarding of `ARFLAGS` to fix the common case.
This is a partial revert of bazelbuild#3704. It does NOT revert logic that properly finds the hermetic archiver (binary and associated tests). cc-rs needs full ownership of flag handling for the archiver. This is in part due to `ar` having very specific positional flag behaviors, and partially due to some special logic in how cc-rs constructs static libraries. The change to enable ARFLAGS was causing many toolchains that pass flags to the static archiver to error out due to conflicting expectations for flag handling. Example bad `ar` invocation, where `cq` is treated as the destination archive instead of the `ar` tool mode: ar rcsD cq dest.a src1.o src2.o This drops forwarding of `ARFLAGS` to fix the common case.
This is a partial revert of bazelbuild#3704. It does NOT revert logic that properly finds the hermetic archiver (binary and associated tests). cc-rs needs full ownership of flag handling for the archiver. This is in part due to `ar` having very specific positional flag behaviors, and partially due to some special logic in how cc-rs constructs static libraries. The change to enable ARFLAGS was causing many toolchains that pass flags to the static archiver to error out due to conflicting expectations for flag handling. Example bad `ar` invocation, where `cq` is treated as the destination archive instead of the `ar` tool mode: ar rcsD cq dest.a src1.o src2.o This drops forwarding of `ARFLAGS` to fix the common case.
|
Though I support the efforts to streamline bazel's toolchain and rust's, this has the potential to affect anything which depends on the https://github.com/rust-lang/cc-rs/blob/9ec00e4bf2a8b087760245b0ec721fb3bd59731f/src/lib.rs#L2747 It is trivial to patch but just adding this here as a warning as this is a fairly fundamental crate to many builds. |
Seeing the same issue – this change results in running |
This is a partial revert of #3704. It does NOT revert logic that properly finds the hermetic archiver (binary and associated tests). cc-rs needs full ownership of flag handling for the archiver. This is in part due to `ar` having very specific positional flag behaviors, and partially due to some special logic in how cc-rs constructs static libraries. The change to enable `ARFLAGS` was causing many toolchains that pass flags to the static archiver to error out due to conflicting expectations for flag handling. Example bad `ar` invocation, where `cq` is treated as the destination archive instead of the `ar` tool mode: ``` ar rcsD cq dest.a src1.o src2.o ``` This drops forwarding of `ARFLAGS` to fix the common case.
|
Yep, this wasn't caught in presubmit due to how toolchains_llvm's ar flags end up being spelled out. Submitted a partial revert (reverted forwarding of AR flags, but not the finding of the archiver tool) as #3763, which is available in 0.68.1. Sorry for the inconvenience here. |
This was preventing ar flags from propagating to the cargo build script runner.