-
Notifications
You must be signed in to change notification settings - Fork 459
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
Conversation
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
cc @sfackler |
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. |
2d81384
to
35d3d1b
Compare
I came across this when I was in an environment where only |
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.
This should be pretty harmless, and avoid anything bad that would be caused by #735. I have seen the |
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`.
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`.
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.