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

rustup-init.sh does not correctly detect host string for Pinebook Pro #2111

Closed
NoraCodes opened this issue Nov 4, 2019 · 16 comments · Fixed by #2133
Closed

rustup-init.sh does not correctly detect host string for Pinebook Pro #2111

NoraCodes opened this issue Nov 4, 2019 · 16 comments · Fixed by #2133

Comments

@NoraCodes
Copy link

Problem
On Pinebook Pro Debian stretch (9.9), rustup-init.sh tries to download rustup-init for aarch64, but that doesn't work; the CPU is ARMv8. Even once I downloaded an armv7 rustup-init, it guessed the wrong target triple.

Possible Solution(s)
Instead of just checking uname, check the actual ld library; on my machine this is only ld-linux-armhf.so.3 and therefore it is detectable that any aarch64 binaries won't run.

@NoraCodes NoraCodes added the bug label Nov 4, 2019
@kinnison
Copy link
Contributor

kinnison commented Nov 5, 2019

Can you please confirm the output of uname -s, uname -m and dpkg --print-architecture ?

@NoraCodes
Copy link
Author

uname -s: Linux
uname -m: aarch64
dpkg --print-architecture: armhf

@kinnison
Copy link
Contributor

kinnison commented Nov 6, 2019

Okay, that's fascinating. I suppose it might be similar to someone running an amd64 kernel and a 32 bit userland, but without running it under a 32 bit personality. Hmm.

Perhaps we could add a check via getconf LONG_BIT which should return 32 for you (if you can confirm?)

@NoraCodes
Copy link
Author

LONG_BIT does indeed report 32, yeah.

@tesuji
Copy link
Contributor

tesuji commented Nov 6, 2019

But is getconf portable enough?

@kinnison
Copy link
Contributor

kinnison commented Nov 6, 2019

I'd only be suggesting the use of getconf when diagnosing a linux system which reports amd64 or aarch64 since those are the natively bi-arch options I think. Others need personality switches IIRC
So it'd be a disambiguation step, not something run everywhere. As for where it comes from -- on Debian it's in libc-bin so I'm guessing it's part of the set of things glibc tends to have. No idea if musl would have it, but we could simply say that if getconf can't run, we assume same bitness as the kernel personality reported.

@kinnison
Copy link
Contributor

kinnison commented Nov 6, 2019

@NoraCodes Short term fix for you would be to download rustup-init.sh and then run it with: linux32 sh rustup-init.sh -- that should get you the right rustup etc.

@NoraCodes
Copy link
Author

Thank you, that worked well.

@kinnison
Copy link
Contributor

kinnison commented Nov 7, 2019

Okay cool, so @NoraCodes can at least get on with Rust on her Pinebook, and I have an idea for how we might resolve this for future users.

@kinnison
Copy link
Contributor

kinnison commented Nov 7, 2019

If anyone wishes to approach this, please let me know here, or via Discord in the #wg-rustup channel.

@kinnison kinnison added this to the 1.21.0 milestone Nov 10, 2019
kinnison added a commit to kinnison/rustup that referenced this issue Nov 11, 2019
@kinnison
Copy link
Contributor

@NoraCodes Could you please try https://raw.githubusercontent.com/kinnison/rustup.rs/kinnison/32bit-linux-on-64bit-kernel/rustup-init.sh which contains the little fix I think we need for this? All you need do is download it, and run it and see if it fetches the right installer. If it doesn't, please run it sh -x rustup-init.sh look for where it starts to inspect /proc/self/exe and copy/paste from there to where it starts downloading the installer, so that I can diagnose better.

@NoraCodes
Copy link
Author

I am away from my PBP at the moment but I will do this tomorrow. Thanks for the prompt attention!

@NoraCodes
Copy link
Author

Sorry that "tomorrow" became Wednesday :/

In any case, I get an error that https://static.rust-lang.org/rustup/dist/armv7-unknown-linux-gnu/rustup-init is 404ing, but that looks like the right decision to download!

kinnison added a commit to kinnison/rustup that referenced this issue Nov 17, 2019
We duplicate the 'eabihf' suffix code here to ensure that if we
select armv7 as a result, we append the ABI suffix if necessary.

This should fix rust-lang#2111

Signed-off-by: Daniel Silverstone <[email protected]>
@kinnison
Copy link
Contributor

@NoraCodes Hmm, 404 seems odd, but we're getting somewhere (It's wanting to change its decision a bit) I'll have a rummage and see what I've missed...

<fx: time-passes>

I've pushed a fix to that branch, I wasn't taking into account the fact that armv7 non-android has an ABI suffix. Could you give that same link a fresh go? If it works then we're sorted.

@NoraCodes
Copy link
Author

Works perfectly, thank you!

@kinnison
Copy link
Contributor

Fabulous, thank you for the testing. I shall file a PR soon.

AJ-Ianozi pushed a commit to AJ-Ianozi/getada-download that referenced this issue Oct 12, 2023
We duplicate the 'eabihf' suffix code here to ensure that if we
select armv7 as a result, we append the ABI suffix if necessary.

This should fix rust-lang#2111

Signed-off-by: Daniel Silverstone <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants