Skip to content
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

Continue to support binutils ar #736

Merged
merged 1 commit into from
Oct 26, 2022

Conversation

jonhoo
Copy link

@jonhoo jonhoo commented Oct 26, 2022

sfackler observed that the binutils package provides binaries named $target-ar (with no -gcc). This patch augments the change made in #735 to continue picking those up too.

sfackler [observed] that the `binutils` package [provides] binaries
named `$target-ar` (with no `-gcc`). This patch augments the change made
in rust-lang#735 to continue picking those up too.

[observed]: alexcrichton/openssl-src-rs#163 (comment)
[provides]: https://packages.debian.org/bullseye/amd64/binutils-aarch64-linux-gnu/filelist
@jonhoo
Copy link
Author

jonhoo commented Oct 26, 2022

cc @sfackler

@sfackler
Copy link
Member

What is the rationale for this change? I think it's generally expected you have a cross binutils in addition to a cross gcc if you are cross compiling. Binutils is a dependency of gcc in Ubuntu for example.

@jonhoo
Copy link
Author

jonhoo commented Oct 26, 2022

I came across this when I was in an environment where only ${target}-gcc-ar was on $PATH, and not the tools provided by binutils. Whether that's a common situation is hard for me to say, but it does seem like it should be a supported one given that it's a standard part of the GCC distributions.

jonhoo pushed a commit to jonhoo/openssl-src-rs that referenced this pull request Oct 26, 2022
A second try at alexcrichton#163.

The GCC convention is that if the toolchain is named `$target-gnu-gcc`,
then ranlib and ar will be available as `$target-gnu-gcc-ranlib` and
`$target-gnu-gcc-ar` respectively. The code as written would infer them
to be `$target-gnu-{ranlib,ar}`, which will only work if the tools from
`binutils` (which follow that convention) are on `$PATH`.

I've also updated the logic in line with the `cc` crate to check that
the inferred `AR`/`RANLIB` is actually executable before setting it as
an override.

See also rust-lang/cc-rs#736.
@thomcc
Copy link
Member

thomcc commented Oct 26, 2022

This should be pretty harmless, and avoid anything bad that would be caused by #735. I have seen the blah-gcc-ar before, so I'll merge it.

@thomcc thomcc merged commit 00befe7 into rust-lang:main Oct 26, 2022
@nagisa nagisa mentioned this pull request Oct 30, 2022
nagisa added a commit to nagisa/gcc-rs that referenced this pull request Oct 30, 2022
As observed in cross-rs/cross#1100, in some
situations `*-gcc-ar` might actually be just broken.

I believe this is most likely just a plain bug in gcc (failing to
consider `--disable-lto` configuration option somewhere in their build
setup,) but for the time being `*-ar` tends to avoid this problem
altogether.

Code added in rust-lang#736 appears to be
preferring `*-gcc-ar`, but no strong rationale is given to prefer one
over the other. `*-gcc-ar` being outright broken sometimes seems like a
rationale strong enough to continue preferring binutils’ `ar`.
@jonhoo jonhoo deleted the continue-binutils-support branch October 31, 2022 21:33
thomcc pushed a commit that referenced this pull request Oct 31, 2022
As observed in cross-rs/cross#1100, in some
situations `*-gcc-ar` might actually be just broken.

I believe this is most likely just a plain bug in gcc (failing to
consider `--disable-lto` configuration option somewhere in their build
setup,) but for the time being `*-ar` tends to avoid this problem
altogether.

Code added in #736 appears to be
preferring `*-gcc-ar`, but no strong rationale is given to prefer one
over the other. `*-gcc-ar` being outright broken sometimes seems like a
rationale strong enough to continue preferring binutils’ `ar`.
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.

3 participants