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

Rust linker crashes on Apple's M1 MAX processors. #91082

Closed
wdanilo opened this issue Nov 20, 2021 · 4 comments · Fixed by #90499
Closed

Rust linker crashes on Apple's M1 MAX processors. #91082

wdanilo opened this issue Nov 20, 2021 · 4 comments · Fixed by #90499
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state O-macos Operating system: macOS T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@wdanilo
Copy link

wdanilo commented Nov 20, 2021

Hi, I've got a new computer and Rust is not working here :(
The machine is MacBook Pro with Apple M1 MAX. I'm using rustc 1.58.0-nightly (46b8e7488 2021-11-07). I'm running the following command:

cargo stable install wasm-pack

And I got a linker error:

error: linking with `cc` failed: exit status: 1
[...]
  = note: 0  0x100314224  __assert_rtn + 128
          1  0x1003197e8  ld::tool::OutputFile::addressAndTarget(ld::Internal const&, ld::Fixup const*, ld::Atom const**) (.cold.1) + 0
          2  0x100253104  ld::tool::OutputFile::addressOf(ld::Internal const&, ld::Fixup const*, ld::Atom const**) + 252
          3  0x100254dfc  ld::tool::OutputFile::applyFixUps(ld::Internal&, unsigned long long, ld::Atom const*, unsigned char*) + 4004
          4  0x100259540  ld::tool::OutputFile::writeAtoms(ld::Internal&, unsigned char*) + 356
          5  0x100250fa4  ld::tool::OutputFile::writeOutputFile(ld::Internal&) + 408
          6  0x100249adc  ld::tool::OutputFile::write(ld::Internal&) + 216
          7  0x1001d71d8  main + 584
          A linker snapshot was created at:
                /tmp/wasm_pack-62a4d5a4ac8d1c70-2021-10-20-103913.ld-snapshot
          ld: Assertion failed: (_mode == modeFinalAddress), function finalAddress, file ld.hpp, line 1190.
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
          

error: failed to compile `wasm-pack v0.10.1`, intermediate artifacts can be found at `/var/folders/v9/4h68z3857tvbn5fc2ftkh36c0000gn/T/cargo-installmletYr`

Click here to see the full output

@wdanilo wdanilo added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 20, 2021
@hkratz
Copy link
Contributor

hkratz commented Nov 20, 2021

@rustbot label O-macos O-arm

@rustbot rustbot added O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state O-macos Operating system: macOS labels Nov 20, 2021
@hkratz
Copy link
Contributor

hkratz commented Nov 20, 2021

Caused by #90342. As a workaround use MACOSX_DEPLOYMENT_TARGET=10.7 cargo +stable install wasm-pack

@wdanilo
Copy link
Author

wdanilo commented Nov 20, 2021

It works, thank you!!

@nagisa
Copy link
Member

nagisa commented Nov 20, 2021

Looks like a…

Duplicate of #90342

@nagisa nagisa closed this as completed Nov 20, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 25, 2021
…etrochenkov

Link with default MACOSX_DEPLOYMENT_TARGET if not otherwise specified.

This PR sets the MACOSX_DEPLOYMENT_TARGET environment variable during the linking stage to our default, if it is not specified. This way it matches the deployment target we pass to llvm. If not set the the linker uses Xcode or Xcode commandline tools default which varies by version.

Fixes rust-lang#90342, rust-lang#91082.

Drive-by fixes to make Rust behave more like clang:
* Default to 11.0 deployment target for ARM64 which is the earliest version that had support for it.
* Set the llvm target to `arm64-apple-macosx<deployment target>` instead of `aarch64-apple-macosx<deployment target>`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state O-macos Operating system: macOS T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants