Skip to content

Conversation

@armandomontanez
Copy link
Contributor

This was preventing ar flags from propagating to the cargo build script runner.

@armandomontanez armandomontanez force-pushed the fix-ar-flags branch 2 times, most recently from 553c3f0 to e0e5ddc Compare October 28, 2025 00:32
Copy link
Collaborator

@UebelAndre UebelAndre left a 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!

@armandomontanez
Copy link
Contributor Author

Looks like the macOS failure is very relevant; the configured toolchain's AR binary is still not making it through. It looks like toolchains_llvm intends to use libtool-darwin, but either it's misconfigured, or something here still isn't picking up that tool.

@armandomontanez
Copy link
Contributor Author

Looks like the macOS failure is very relevant; the configured toolchain's AR binary is still not making it through. It looks like toolchains_llvm intends to use libtool-darwin, but either it's misconfigured, or something here still isn't picking up that tool.

Hmm... or not. Looks like it's failing on other builds too. Test log contents:

exec ${PAGER:-/usr/bin/less} "$0" || exit 1
Executing tests from //test/cc_shared_library:test
-----------------------------------------------------------------------------
external/bazel_tools/tools/test/collect_cc_coverage.sh: line 99: : command not found
error: coverage collection script failed

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.
@armandomontanez
Copy link
Contributor Author

Hmm, Cross compilation with bzlmod on macOS does appear to be a real failure. Got mixed up with another failure.

TL;DR: cc-rs does not properly support libtool, which means enabling support for respecting the AR toolchain breaks all macOS toolchains that use libtool or llvm-libtool-darwin.

@armandomontanez armandomontanez marked this pull request as draft October 28, 2025 21:50
@armandomontanez
Copy link
Contributor Author

armandomontanez commented Nov 2, 2025

I'd much rather emit an error if libtool is in use rather than using a non-hermetic ar, but that's a breaking change. For now, I'll retain the previous behavior but make it more likely to work as intended (catching llvm-libtool-darwin in addition to libtool, and clearing ARFLAGS that are now properly forwarded for other archiver tools).

I'll try to add libtool support to cc-rs in parallel, but probably shouldn't block on that.

@armandomontanez armandomontanez marked this pull request as ready for review November 2, 2025 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants