Skip to content

bootstrap should not use rustc --version to detect the build triple on on Mac Apple Silicon M1 arm64 #104723

Closed
@HarrisonMc555

Description

@HarrisonMc555

TL;DR

I understand that Apple Silicon/M1/Arm is not supported as a tier 1 target. However, I was hoping that I would be able to compile the Rust compiler with Rosetta support. However, I could not do so.

Details

I did a fresh clone of the rust repository and tried to compile it by running ./x.py. However, it gave me the following errors:

  = note: ld: warning: ignoring file /opt/homebrew/Cellar/xz/5.2.7/lib/liblzma.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
          Undefined symbols for architecture x86_64:
            "_lzma_code", referenced from:
                xz2::stream::Stream::process::h73782f45eb644e15 in libxz2-35bd6285e11c4f9a.rlib(xz2-35bd6285e11c4f9a.xz2.e97199be-cgu.2.rcgu.o)
            "_lzma_end", referenced from:
                _$LT$xz2..stream..Stream$u20$as$u20$core..ops..drop..Drop$GT$::drop::h9a9d62c278838afd in libxz2-35bd6285e11c4f9a.rlib(xz2-35bd6285e11c4f9a.xz2.e97199be-cgu.2.rcgu.o)
            "_lzma_stream_decoder", referenced from:
                xz2::stream::Stream::new_stream_decoder::hfed3d487f93f4786 in libxz2-35bd6285e11c4f9a.rlib(xz2-35bd6285e11c4f9a.xz2.e97199be-cgu.2.rcgu.o)
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

I expected to see this happen: I expected to be able to compile the Rust compiler on my machine.

Instead, this happened: I could not compile the Rust compiler on my machine.

I can see the warning that "building for macOS-x86_64 but attempting to link with file built for macOS-arm64". However, I don't know how to change that. I'm also a bit confused by the difference in reporting from the rust tools themselves vs. the file command. The tools themselves report "x86_64", but the file command reports "arm64".

$ rustc --version --verbose
rustc 1.64.0 (a55dd71d5 2022-09-19)
binary: rustc
commit-hash: a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52
commit-date: 2022-09-19
host: x86_64-apple-darwin
release: 1.64.0
LLVM version: 14.0.6

$ file $(which rustc)
/Users/harrisonmccullough/.cargo/bin/rustc: Mach-O 64-bit executable arm64

$ cargo --version --verbose
cargo 1.64.0 (387270bc7 2022-09-16)
release: 1.64.0
commit-hash: 387270bc7f446d17869c7f208207c73231d6a252
commit-date: 2022-09-16
host: x86_64-apple-darwin
libgit2: 1.4.2 (sys:0.14.2 vendored)
libcurl: 7.79.1 (sys:0.4.55+curl-7.83.1 system ssl:(SecureTransport) LibreSSL/3.3.6)
os: Mac OS 12.5.1 [64-bit]

$ file $(which cargo)
/Users/harrisonmccullough/.cargo/bin/cargo: Mach-O 64-bit executable arm64

Meta

$ rustc --version --verbose
rustc 1.64.0 (a55dd71d5 2022-09-19)
binary: rustc
commit-hash: a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52
commit-date: 2022-09-19
host: x86_64-apple-darwin
release: 1.64.0
LLVM version: 14.0.6
$ uname -a
Darwin Harrison-MacBook-Pro 21.6.0 Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:23 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T6000 arm64 arm Darwin

$ git log --format=%H -n1
736c675d2ab65bcde6554e1b73340c2dbc27c85a

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.O-AArch64Armv8-A or later processors in AArch64 modeO-macosOperating system: macOST-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions