[Apple M1] Cant build Zomes on aarch64-apple-darwin

Hello everyone,

I am trying to code my first hApp on my Mac mini that has a M1 chip.

I have followed the standard instructions to get started but executing:
CARGO_TARGET_DIR=target cargo build --release --target wasm32-unknown-unknown

Fails with error:

info: syncing channel updates for '1.45.2-aarch64-apple-darwin'
info: latest update on 2020-08-03, rust version 1.45.2 (d3fb005a3 2020-07-31)
error: target 'aarch64-apple-darwin' not found in channel.  Perhaps check https://doc.rust-lang.org/nightly/rustc/platform-support.html for available targets
error: backtrace:
error:    0: backtrace::capture::Backtrace::new_unresolved
   1: error_chain::backtrace::imp::InternalBacktrace::new
   2: rustup::dist::manifest::Manifest::get_profile_components
   3: rustup::dist::dist::try_update_from_dist_
   4: rustup::install::InstallMethod::install
   5: rustup::toolchain::DistributableToolchain::install_from_dist
   6: rustup::config::Cfg::find_or_install_override_toolchain_or_default
   7: rustup_init::main
   8: std::sys_common::backtrace::__rust_begin_short_backtrace
   9: _main

I guess this is due to the lack of support of the architecture with that particular version of rust. Do you know if there is anything I can do to get going?

Thank you!

Hi,

It mentions here Rust 1.49 in relation to bringing support for M1, I’m wondering if it might work for you to upgrade to that version of Rust.

Thank you for your reply!!

Would you know how to do this upgrade in nix shell?

Thank you again!

1 Like

Should be like…

rustup toolchain install 1.49.0

within the nix-shell

Thank you for your answer!

The command works, it does install 1.49.0 but when I go back to doing

CARGO_TARGET_DIR=target cargo build --release --target wasm32-unknown-unknown

It is still 1.45 which is called.

Same when I just launch rustc, it goes back to 1.45.

That’s why I wonder if this should not be changed in default.nix before running nix-shell?

Would you have any idea?

Thank you again for taking the time!

No problem.

Just use

rustup default 1.49

And you’ll actually switch to it. Till then it’s installed but not specified.

Hi thank you!

This is what I did but rustc is still in 1.45.2 even after I run rustup default 1.49 :frowning:

For some reason, it now works although I did not touch it in a week… Mystery.

That is weird! But good!