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

Allow builds on M1 Macs #933

Closed
wants to merge 1 commit into from
Closed

Allow builds on M1 Macs #933

wants to merge 1 commit into from

Conversation

me-no-dev
Copy link

@me-no-dev me-no-dev commented Mar 31, 2022

Motivation

The only thing preventing builds on M1 macs is failure in downloading arduino-language-server. While other downloads do not check the arch, it is checked here. Adding case for darwin-arm64 fixes the issue.

Change description

Adds case for darwin-arm64

Other information

None

Reviewer checklist

  • PR addresses a single concern.
  • The PR has no duplicates (please search among the Pull Requests before creating one)
  • PR title and description are properly filled.
  • Docs have been added / updated (for bug fixes / features)

The only thing preventing builds on M1 macs is failure in downloading `arduino-language-server`. While other downloads do not check the arch, it is checked here. Adding case for `darwin-arm64` fixes the issue.
@per1234 per1234 added topic: infrastructure Related to project infrastructure architecture: arm Specific to ARM host architecture os: macos Specific to macOS operating system labels Mar 31, 2022
@per1234 per1234 requested a review from AlbyIanna March 31, 2022 15:23
@per1234 per1234 removed the request for review from AlbyIanna March 31, 2022 15:23
@kittaakos
Copy link
Contributor

Related: #666

@kittaakos
Copy link
Contributor

@me-no-dev, thanks for the contribution. We're also working on it. With your patch, the build might correctly download the LS, but it does not fix the M1 build issue in the long run. If we want to build a native M1 app on M1, the universal target is required for the electron-builder. However, if all is configured correctly, the packaging will fail with such an error:

fatal error: /Library/Developer/CommandLineTools/usr/bin/lipo: /private/var/folders/zw/1kzgfzm90gd5brlbb91y217m0000gn/T/electron-universal-dpvxj4/Tmp.app/Contents/Resources/app/node_modules/arduino-ide-extension/build/arduino-cli and /Users/tooling/Desktop/a.kitta/arduino-ide/electron/build/dist/mac-universal--arm64/Arduino IDE.app/Contents/Resources/app/node_modules/arduino-ide-extension/build/arduino-cli have the same architectures (x86_64) and can't be in the same fat output file
    at ChildProcess.<anonymous> (/Users/tooling/Desktop/a.kitta/arduino-ide/electron/build/node_modules/@malept/cross-spawn-promise/src/index.ts:172:16)

arduino-cli have the same architectures (x86_64) and can't be in the same fat output file

This 👆 shows that the M1 (arm64) IDE2 app strickly requires an arm64 CLI. It does not exist yet.

@me-no-dev
Copy link
Author

@kittaakos agreed that this is not a long term solution, but was here to help ones that want to build on M1 currently :) Feel free to close

@kittaakos
Copy link
Contributor

was here to help ones that want to build on M1 currently :)

Thank you so much ❤️

Feel free to close

Let's leave it open. There is progress. We have some blockers, but we are working on the M1 support.

Related: main...kittaakos:m1

@Edivad99
Copy link

Edivad99 commented Jun 1, 2022

Doesn't the CLI already use a recent version of GO that supports Apple Silicon?

@kittaakos
Copy link
Contributor

@umbynos, could you please chime in and summarize what is missing on the CLI/LS part? We do not yet have a container for darwin/arm64 if I remember correctly.

Also, even if we can build the CLI on an M1 chip, it does not fit into the current GitHub Actions-based pipeline: actions/runner-images#2187.

@kittaakos kittaakos self-assigned this Jun 2, 2022
@umbynos
Copy link

umbynos commented Jun 7, 2022

At the current time, we do not have a way of building the arduino-cli using golang crosscompile because we need the support for CGO on macOS to be able to reset a board when flashing it

@Edivad99
Copy link

Now that this PR has been closed is it possible to develop a dedicated version for Apple Silicon?

@umbynos
Copy link

umbynos commented Jun 28, 2022

Hi @Edivad99, having a native Arduino CLI arm64 darwin build unfortunately was only a starting point. Some more action items are required. There are other binaries required by the ide to be able to run natively on M1:

  • Arduino Language server (should be pretty easy since we use the same containers as the CLI)
  • Arduino FW Uploader (we use go native build, should need a go version bump)
  • Clangd + Clang Format (these ones should be the difficult ones: as of now for macos we use the vms offered by github, so it's a native build. Maybe we could try to use our shiny crossbuild container to crosscompile, but this won't be easy)

@kittaakos
Copy link
Contributor

  • Clangd + Clang Format (these ones should be the difficult ones: as of now for macos we use the vms offered by github, so it's a native build. Maybe we could try to use our shiny crossbuild container to crosscompile, but this won't be easy)

For the time being, we could build it on M1 manually and upload the artifacts. I know this is suboptimal, but it could speed up things until we have all the workflows and pipelines running on an M1 container.

@ubidefeo ubidefeo added priority: medium Resolution is a medium priority labels Sep 2, 2022
@per1234 per1234 mentioned this pull request Sep 8, 2022
@lbibass
Copy link

lbibass commented Sep 14, 2022

any update on this?

@umbynos
Copy link

umbynos commented Sep 15, 2022

There are other binaries required by the ide to be able to run natively on M1:

  • Arduino Language server (should be pretty easy since we use the same containers as the CLI)
  • Arduino FW Uploader (we use go native build, should need a go version bump)
  • Clangd + Clang Format (these ones should be the difficult ones: as of now for macos we use the vms offered by github, so it's a native build. Maybe we could try to use our shiny crossbuild container to crosscompile, but this won't be easy)

Status update:

@umbynos
Copy link

umbynos commented Oct 20, 2022

everything done, releases here:

@kittaakos
Copy link
Contributor

Upstream issues:

@per1234 per1234 added the type: enhancement Proposed improvement label Oct 26, 2022
@kittaakos
Copy link
Contributor

Thank you for initiating the support of the M1 build. It was implemented in #1577.

Closing this PR as a duplicate.

@kittaakos kittaakos closed this Nov 2, 2022
@kittaakos kittaakos added the conclusion: duplicate Has already been submitted label Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
architecture: arm Specific to ARM host architecture conclusion: duplicate Has already been submitted os: macos Specific to macOS operating system priority: medium Resolution is a medium priority topic: infrastructure Related to project infrastructure type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants