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

When running a 32-bit rustup on an aarch64 CPU, select a 32-bit toolchain #3490

Merged
merged 1 commit into from
Oct 5, 2023

Conversation

alex
Copy link
Member

@alex alex commented Sep 23, 2023

this mirrors a similar check that exists in rustup-init.sh

fixes #3307

Copy link
Member

@rami3l rami3l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Although I originally expected a runtime detection of the userland's bitness, this approach of using the comptime info does seem to be okay, since being able to run a 32-bit rustup does imply that the current system at least has a 32-bit libc.

Thus, this should fix the Raspberry Pi issue if the user is indeed running a 32-bit version of rustup.

@rami3l
Copy link
Member

rami3l commented Sep 24, 2023

It's okay to merge this PR first anyway that will indeed fix a common use case...

However, I'm still wondering if something similar will happen on other platforms, and if this approach should be further generalized.

cc @rbtcollins

@rami3l
Copy link
Member

rami3l commented Sep 24, 2023

@alex It suddenly occurred to me that some people might be running Pi OS with a 64-bit userland, with 32-bit compatibility mode enabled, and even have accidentally downloaded a 32-bit rustup binary...

So I guess making the bitness check a runtime one might still be better after all. This way, it will also address your concerns around host/target differences even better. What do you think?

@alex
Copy link
Member Author

alex commented Sep 24, 2023

A runtime check would produce the same results, unless you're suggesting we check /bin/sh or some system binary?

@rami3l
Copy link
Member

rami3l commented Sep 24, 2023

@alex I just saw where my misunderstanding was, so sorry for not being clear enough previously! 🙏🙏🙏

I did mean to say /bin/sh and I think it should be safe to assume that the machine that runs rustup has it.

@alex
Copy link
Member Author

alex commented Sep 24, 2023

I think what I'll do is check /bin/sh, but if it doesn't exist, fall back to checking the rustup binary.

src/dist/dist.rs Outdated Show resolved Hide resolved
src/dist/dist.rs Show resolved Hide resolved
…hain

this mirrors a similar check that exists in rustup-init.sh

fixes rust-lang#3307
@rami3l rami3l merged commit 745473d into rust-lang:master Oct 5, 2023
16 checks passed
@djc djc mentioned this pull request Oct 5, 2023
@alex alex deleted the rustup-arm32 branch October 5, 2023 14:32
@rami3l rami3l mentioned this pull request Jan 29, 2024
1 task
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.

rustup installs incorrect version when 64 bit kernel enabled in 32bit OS.
3 participants