rustup icon indicating copy to clipboard operation
rustup copied to clipboard

rustup does not check if rosetta installed on mac

Open babinskiy opened this issue 9 months ago • 4 comments

Verification

  • [x] I searched for recent similar issues at https://github.com/rust-lang/rustup/issues?q=is%3Aissue+is%3Aopen%2Cclosed and found no duplicates.
  • [x] I am on the latest version of Rustup according to https://github.com/rust-lang/rustup/tags and am still able to reproduce my issue.

Problem

Since version 1.28.0, rustup checks if the host system is compatible and fails the installation if it is not (see rust-lang/rustup#4028). However, Apple M1 systems are compatible with x86_64 architecture if Rosetta is installed. Unfortunately, rustup does not account for this compatibility.

Steps

  1. Have an Apple M1 box with Rosetta
%  sysctl -a | grep machdep.cpu.brand
machdep.cpu.brand_string: Apple M1
  1. Try to install x64 rust toolchain:
% rustup toolchain install 1.85.0-x86_64-apple-darwin
error: toolchain '1.85.0-x86_64-apple-darwin' may not be able to run on this system
note: to build software for that platform, try `rustup target add x86_64-apple-darwin` instead
note: add the `--force-non-host` flag to install the toolchain anyway

Possible Solution(s)

Use --force-non-host flag:

% rustup toolchain install --force-non-host 1.85.0-x86_64-apple-darwin
info: syncing channel updates for '1.85.0-x86_64-apple-darwin'

  1.85.0-x86_64-apple-darwin unchanged - rustc 1.85.0 (4d91de4e4 2025-02-17)

Notes

No response

Rustup version

rustup 1.28.1 (f9edccde0 2025-03-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.85.0 (4d91de4e4 2025-02-17)`

Installed toolchains

Default host: aarch64-apple-darwin
rustup home:  /Users/administrator/.rustup

installed toolchains
--------------------
stable-aarch64-apple-darwin
beta-aarch64-apple-darwin
nightly-aarch64-apple-darwin
1.65.0-aarch64-apple-darwin
1.65.0-x86_64-apple-darwin
1.71.0-aarch64-apple-darwin
1.71.0-x86_64-apple-darwin
1.74.0-aarch64-apple-darwin
1.74.0-x86_64-apple-darwin
1.75.0-aarch64-apple-darwin
1.75.0-x86_64-apple-darwin
1.78.0-aarch64-apple-darwin
1.78.0-x86_64-apple-darwin
1.80.0-aarch64-apple-darwin
1.80.0-x86_64-apple-darwin
1.80.1-aarch64-apple-darwin
1.80.1-x86_64-apple-darwin
1.85.0-aarch64-apple-darwin (active, default)
1.85.0-x86_64-apple-darwin

active toolchain
----------------
name: 1.85.0-aarch64-apple-darwin
active because: it's the default toolchain
installed targets:
  aarch64-apple-darwin

OS version

ProductName:    macOS
ProductVersion: 11.7.10
BuildVersion:   20G1427

babinskiy avatar Mar 07 '25 17:03 babinskiy

Why do you want to insist on installing a non-native version? And why is the --force-non-host option not good enough for your use case?

djc avatar Mar 07 '25 18:03 djc

@djc Back in v1.26.0 rustup would happily accept x64 as a native host and we have got a lot for surprising behaviors because of that (mostly linkage errors). That's why we accepted juliaup's patch explicitly for detecting Rosetta 2 and are now warning the user about it. As such I don't think we'll be working in the opposite direction...

rami3l avatar Mar 08 '25 01:03 rami3l

@rami3l yes, that is also my stance -- I was pushing back.

djc avatar Mar 08 '25 06:03 djc

Just ran into the same.

To answer @djc's comments:

  • Why insist on installing a non-native version?

In order to test older versions of Rust that don't have aarch64 binaries.

  • Why is --force-non-host not good enough?

It works, I guess, but it's confusing. --force-non-host lets me install binaries built for random other OSes and architectures, binaries that have no chance of running on my system. It's odd that the same option is also needed to install binaries that definitely will run on my system.

comex avatar May 11 '25 23:05 comex