freeCodeCamp / solana-curriculum

freeCodeCamp Solana Curriculum
BSD 3-Clause "New" or "Revised" License
130 stars 50 forks source link

[BUG]: Containers can't be build on M1 #19

Open studentofcoding opened 2 years ago

studentofcoding commented 2 years ago

Project

Installation process

Lesson Number

-

Issue/Experience

I think it only supports linux for now?

Code and Screenshots


=> ERROR [13/19] RUN sh -c "$(curl -sSfL https://release.solana.com/stab  2.2s
------                                                                          
 > [13/19] RUN sh -c "$(curl -sSfL https://release.solana.com/stable/install)": 
#0 1.247 downloading stable installer
#0 2.198 curl: (22) The requested URL returned error: 403 
#0 2.205 solana-install-init: command failed: downloader https://release.solana.com/stable/solana-install-init-aarch64-unknown-linux-gnu /tmp/tmp.M3vwjj3cRL/solana-install-init
------
ERROR: failed to solve: executor failed running [/bin/sh -c sh -c "$(curl -sSfL https://release.solana.com/stable/install)"]: exit code: 1
ShaunSHamilton commented 2 years ago

Thank you for taking the time to open this.

This is odd, because the solana cli is being installed on Linux (Ubuntu20.04). This is the whole point of using Docker.

I will investigate this further, but it seems the issue has to do with the curl request being blocked by your workspace. I suggest seeing if you can access the URL in your browser.

I would double-check your DNS settings as well as firewall which could be blocking the request.

laitsky commented 2 years ago

Facing the similar issue as well on M1, looks like this is ARM-specific problem since there's a dude on Discord getting the same trouble.

ojasuno commented 2 years ago
docker-inocmpatible-error

has anyone run into docker issue, when running on the new M1

ojasuno commented 2 years ago

managed to resolve above Docker issue, not getting stuck here, when it is building the Dockerfile

 => ERROR [13/19] RUN sh -c "$(curl -sSfL https://release.solana.com/stab  2.1s

[2022-09-23T08:37:26.179Z]                 

------
 > [13/19] RUN sh -c "$(curl -sSfL https://release.solana.com/stable/install)":
#0 1.116 downloading stable installer
#0 2.022 curl: (22) The requested URL returned error: 403 
#0 2.043 solana-install-init: command failed: downloader https://release.solana.com/stable/solana-install-init-aarch64-unknown-linux-gnu /tmp/tmp.TLQ5Qw4STt/solana-install-init
------
[2022-09-23T08:37:26.179Z] ERROR: failed to solve: executor failed running [/bin/sh -c sh -c "$(curl -sSfL https://release.solana.com/stable/install)"]: exit code: 1
ShaunSHamilton commented 2 years ago

While we are still looking for a fix, we suggest running the course in Gitpod:

NOTE: The course tools are complex, and we have not confirmed every project/lesson will work in Gitpod either.

https://user-images.githubusercontent.com/51722130/191953015-61c1f0d5-eebc-4fe2-ac26-ef37cb0e873c.mp4

ojasuno commented 2 years ago

a workaround for now, i downloaded the install file and changed the Dockerfile to execute it locally

# Solana
#RUN sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
CMD install
scissorsneedfoodtoo commented 2 years ago

Did some testing on my M1 Air last week and ran into this issue as well.

I believe it's because Solana's install script takes the container's CPU type into account when deciding which version to download and install. And it seems that, unless a platform is specified, Docker will try to pull an Ubuntu image that's closest to the host's CPU type, which for M1 is aarch64 / ARM64.

Then for Solana, it turns out there are no prebuilt aarch64 version for Linux, just x86_64 / amd64. There are other aarch64 builds, but only for Apple machines: https://github.com/solana-labs/solana/releases/tag/v1.14.2

It's possible to force Docker to build a container using x86_64 Ubuntu with FROM --platform=linux/amd64 ubuntu:20.04. This seems to work, and Solana can install properly while building the container and in one of the early lesson steps.

But once you hit the solana-test-validator step, you'd probably get the following error message: Incompatible CPU detected: missing AVX support. Please build from source on the target.

Turns out that M1 / M2 CPUs don't support AVX or AVX2 instructions, which solana-test-validator uses under the hood. It should be possible to compile Solana from source to get around that, but I ran into some issues while doing that inside the x86_64 Ubuntu container.

The easiest thing for people with M1 / M2 machines to do would be to use GitPod or something similar like @ShaunSHamilton mentioned. Then the container should be built on an x86 machine, and shouldn't run into the same issue with solana-test-validator and the lack of AVX2 support.

guycode commented 2 years ago

failing install on new M1 as well with devcontainer.json.

codingxjourney commented 2 years ago

[2022-10-22T18:26:00.652Z] l https:// 0.0s => ERROR [dev_container_auto_added_stage_label 13/19] RUN sh -c "$(curl 3.6s

[dev_container_auto_added_stage_label 13/19] RUN sh -c "$(curl -sSfL https://release.solana.com/stable/install)":

0 1.477 downloading stable installer

0 3.600 curl: (22) The requested URL returned error: 403

0 3.609 solana-install-init: command failed: downloader https://release.solana.com/stable/solana-install-init-aarch64-unknown-linux-gnu /tmp/tmp.snPZp3xpUo/solana-install-init


[2022-10-22T18:26:00.652Z] ERROR: failed to solve: executor failed running [/bin/sh -c sh -c "$(curl -sSfL https://release.solana.com/stable/install)"]: exit code: 1 [2022-10-22T18:26:00.657Z] Stop (9533 ms): Run: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /var/folders/xk/7pnplynn383f5ld8wbd2t_8r0000gn/T/devcontainercli/container-features/0.20.0-1666463151087/Dockerfile-with-features -t vsc-solana-curriculum-00a53c8e8217084823e448bec660d7f9 --target dev_containers_target_stage --build-context dev_containers_feature_content_source=/var/folders/xk/7pnplynn383f5ld8wbd2t_8r0000gn/T/devcontainercli/container-features/0.20.0-1666463151087 --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp /Users/codingxjourney/solana-curriculums/solana-curriculum [2022-10-22T18:26:00.658Z] Error: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /var/folders/xk/7pnplynn383f5ld8wbd2t_8r0000gn/T/devcontainercli/container-features/0.20.0-1666463151087/Dockerfile-with-features -t vsc-solana-curriculum-00a53c8e8217084823e448bec660d7f9 --target dev_containers_target_stage --build-context dev_containers_feature_content_source=/var/folders/xk/7pnplynn383f5ld8wbd2t_8r0000gn/T/devcontainercli/container-features/0.20.0-1666463151087 --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp /Users/codingxjourney/solana-curriculums/solana-curriculum [2022-10-22T18:26:00.658Z] at Vse (/Users/username/.vscode/extensions/ms-vscode-remote.remote-containers-0.255.4/dist/spec-node/devContainersSpecCLI.js:1869:1635) [2022-10-22T18:26:00.658Z] at process.processTicksAndRejections (node:internal/process/task_queues:96:5)

duy211099 commented 1 year ago

a workaround for now, i downloaded the install file and changed the Dockerfile to execute it locally

# Solana
#RUN sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
CMD install

it's worked. Thank you!

branddesade commented 11 months ago

a workaround for now, i downloaded the install file and changed the Dockerfile to execute it locally

# Solana
#RUN sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
CMD install

it's worked. Thank you!

not working for me

ShaunSHamilton commented 11 months ago

@branddesade What errors can you see in the logs?

zzz6519003 commented 6 months ago

works on my windows but not my m1 mac too

eric-gg commented 1 day ago

This really needs a fix, Mac M\d based machines aren't exactly rare in the dev community.