-
Notifications
You must be signed in to change notification settings - Fork 892
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 installs incorrect version when 64 bit kernel enabled in 32bit OS. #3307
Comments
Another acceptable solution in this case could be to fail to autopopulate the host triple and force the user to manually set it |
What does I want to determine if the wrong |
|
We recognised the same:
The rustup installer uses this function to check for 32-bit userland when 64-bit CPU arch is detected, which obviously works fine. Probably this can be used as starting point for doing the same in rustup itself: get_bitness() {
need_cmd head
# Architecture detection without dependencies beyond coreutils.
# ELF files start out "\x7fELF", and the following byte is
# 0x01 for 32-bit and
# 0x02 for 64-bit.
# The printf builtin on some shells like dash only supports octal
# escape sequences, so we use those.
local _current_exe_head
_current_exe_head=$(head -c 5 /proc/self/exe )
if [ "$_current_exe_head" = "$(printf '\177ELF\001')" ]; then
echo 32
elif [ "$_current_exe_head" = "$(printf '\177ELF\002')" ]; then
echo 64
else
err "unknown platform bitness"
fi
} |
Triage Report 1Related issues#2498 #2565 #3431 #3342 #3471 #3487 2 Possible causehttps://forums.raspberrypi.com/viewtopic.php?t=289963#p1756063 says:
#2565 (comment) says:
So I suspect that Possible solutionWe could choose to do one (or many) of the following:
Footnotes
|
The proximate cause is here: https://github.com/rust-lang/rustup/blob/master/src/dist/dist.rs#L323-L361
I think the best choice is to automatically handle this case and set a 32-bit default-target for the installed rustc. However, I'm not positive what the correct way to detect this situation is. One choice is simply checking: is the running rustup a 32-bit process? If so, select a 32-bit target. Are there cases where that's not correct (i.e., where we'd be running a 32-bit rustup on a 64-bit kernel, but want a rustc which is 64-bit by default)? I'm happy to develop a PR for either this approach, or any other approach folks can think of. |
@alex Exactly. After triaging all those issues it does seem to me that the If you would like to make a PR to address this issue, please do! I'll try my best to review it in that case :) |
👍, my only hesitation is that https://github.com/rust-lang/rustup/blob/master/src/dist/dist.rs#L373 seems to deliberately prefer the host target to the build target, and this would invert that (for this situation). If it sounds good to you, I'll send a PR for it tomorrow! |
@alex I'm not sure if we are on the same page here, but I believe that inspecting the head of |
…hain this mirrors a similar check that exists in rustup-init.sh fixes rust-lang#3307
…hain this mirrors a similar check that exists in rustup-init.sh fixes rust-lang#3307
…hain this mirrors a similar check that exists in rustup-init.sh fixes rust-lang#3307
…hain this mirrors a similar check that exists in rustup-init.sh fixes rust-lang#3307
I'm still getting this same issue when using rustup in an armv7 Docker container on an aarch64 host. |
What version did you try with? Did you try the beta? https://internals.rust-lang.org/t/seeking-beta-testers-for-rustup-1-27-0/20352/7 |
@djc It looks like it works properly with the beta. Thanks!
@rami3l I do have a separate issue where the installation just hangs, but the architecture was also not detected properly, so I had to force the target explicitly. It looks like the detection issue is now resolved in the beta. |
Problem
When attempting to install Rust in a 32-bit environment with a 64 kernel the wrong version is installed. This is due to rustup determining 64/32 bit from what is available, not what is being used
Steps
arm_64bit=1
in /boot/config.txt)Possible Solution(s)
getconf LONG_BIT
is a better solution thanuname -m
for determining whether the user is operating in 64 bit or 32 bit (which is more in line with user specific installation)Notes
Execution of rustc after running rustup:
Rustup version
Installed toolchains
The text was updated successfully, but these errors were encountered: