SDK Install script does take Linux-aarch64 into consideration.
ocluf opened this issue · comments
I want create a starter canister repo with a devcontainer so that everybody can easily clone it and get started without worrying about needing to install the toolchain.
However since I don't have an intel laptop but an M1 it seems that the install script fails at get_architecture()
when I try to run
RUN sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)"
I expected to see this happen:
The sdk getting installed in my docker image
Instead, this happened:
Error exit code 1: dfinity-sdk: unknown CPU type: aarch64
dfx
currently requires you to have rosetta installed. You can install it by running softwareupdate --install-rosetta
in your terminal. With rosetta installed, x86_64
will be an available architecture and dfx should run without any problems.
I made a note to update docs and install script to provide instructions in that case. It can easily be detected and we should provide proper error messages in that case.
The error didn't surface on my device, but when I try to build a docker container with a dev environment. I got it working by adding the --platform=linux/x86_64 flag in:
FROM --platform=linux/x86_64 mcr.microsoft.com/vscode/devcontainers/rust:0-${VARIANT}
The build is quite slow though due to needing to emulate x86_64 with QEMU. I could publish an image but devs might rather build it from scratch so they can trust it better. I also don't know how it would perform on a macbook air.
I'm unblocked for now so this issue can be closed. I'll see if I can find a cleaner way to choose the target platform so everybody can use the .devcontainer configuration without needing to make manual changes. Do you know why dfx can't be build for ARM? I know lots of people at the foundation have ARM macs as well so I assume it has been tried.
Hmm sadly I did not get it working in the end. The docker container successfully was build but when I try to run a local replica I get the following error.
dfx start -v
Running dfx start for version 0.12.1
There is no project-specific network 'local' defined in /workspaces/starter/dfx.json
Using the default definition for the 'local' shared network because /root/.config/dfx/networks.json does not exist.
Local server configuration:
bind address: 127.0.0.1:4943
bitcoin: disabled
canister http: enabled
log level: Error
replica:
subnet type: Application
log level: Error
data directory: /root/.local/share/dfx/network/local
scope: shared
Version v0.12.1 installed successfully.
Starting canister http adapter...
canister http adapter ready
Starting replica...
thread 'replica-actor' panicked at 'called Result::unwrap()
on an Err
value: Cannot start the replica: Timeout', src/dfx/src/actors/replica.rs:376:78
note: run with RUST_BACKTRACE=1
environment variable to display a backtrace
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted
Has someone at the foundation successfully ran a replica in a docker container on an ARM macbook?