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

Build linux-aarch64 (arm64) release binaries #714

Closed
3 tasks done
avh4 opened this issue Oct 18, 2020 · 15 comments
Closed
3 tasks done

Build linux-aarch64 (arm64) release binaries #714

avh4 opened this issue Oct 18, 2020 · 15 comments

Comments

@avh4
Copy link
Owner

avh4 commented Oct 18, 2020

This should be done in a reproducible way, preferably by being able to build locally using docker and buildx support for a locally-running arm container win docker-supported qemu.

Starting point: https://www.docker.com/blog/multi-arch-images/
https://docs.docker.com/buildx/working-with-buildx/
https://tech.smartling.com/building-multi-architecture-docker-images-on-arm-64-c3e6f8d78e1c

docker build ... becomes docker buildx build --platform linux/arm64 ...

Related:

Blockers:

@avh4 avh4 added this to the 0.8.5 milestone Oct 18, 2020
@avh4 avh4 changed the title Build arm64 linux release binaries Build linux-aarch64 (arm64) release binaries Feb 5, 2021
@avh4 avh4 modified the milestones: 0.8.5, 1.0.0 public release Feb 6, 2021
@avh4
Copy link
Owner Author

avh4 commented Sep 8, 2021

@Zeneixe
Copy link

Zeneixe commented May 25, 2022

Any chance this platform's support will be added? @avh4

@avh4
Copy link
Owner Author

avh4 commented May 27, 2022

I might be getting some new hardware that'll be able to build aarch64 binaries soon.

In the meantime, the issue is that Github Actions CI (or any other free-for-open-source-projects CI that I've found so far) doesn't provide any aarch64 or arm64 runners yet afaik. If anyone has any info about that, please share it!

@Zeneixe
Copy link

Zeneixe commented May 29, 2022

@avh4
Copy link
Owner Author

avh4 commented May 29, 2022

https://github.com/uraimo/run-on-arch-action

Ooh, that's great! Thanks!

@ParetoOptimalDev
Copy link

ParetoOptimalDev commented Aug 29, 2022

Hi, I use NixOS to successfully and simply build elm-format for aarch64-linux like:

nix-build -A pkgsCross.aarch64-multiplatform-musl.pkgsStatic.elmPackages.elm-format

You can easilly do this on github actions by following this tutorial.

You can also similarily build the aarch64-darwin version of elm-format like:

nix-build -A pkgsCross.aarch64-darwin.elmPackages.elm-format

Actually.. the first one says multi-platform so maybe it also works for aarch64-darwin? I can't say for sure since I haven't tried.

So it's possible this could solve this issue and the related #723.

@ParetoOptimalDev
Copy link

I made a github action following the tutorial I linked above, let's see if it everything works the first time and gives us that binary 😄

https://github.com/ParetoOptimalDev/elm-format/runs/8063581557?check_suite_focus=true

@ParetoOptimalDev
Copy link

Looks like it's working just like it does for me locally, but first build will take forever. Since I setup cachix with it though, the subsequent ones will be fast.

@avh4
Copy link
Owner Author

avh4 commented Aug 29, 2022

Oh, exciting! I had tried pkgsCross in the past and it didn't work (and had also filed some bugs with nixpkgs that got closed as "won't fix"). If it works now, that'd be great!

Cachix requires a paid account, right? Though it doesn't really matter, since if it works, I'll probably just build it locally with nix anyway.

Does nix-build -A pkgsCross.aarch64-darwin.elmPackages.elm-format work for you on linux or only on MacOS? It gives "error: infinite recursion encountered" for me on Ubunutu with nix 2.8.1. That was one of the nixpkgs issues I filed that got closed "won't fix".

@ParetoOptimalDev
Copy link

Huh, nix-build -A pkgsCross.aarch64-darwin.elmPackages.elm-format evne gives me the inifinite recursion error on NixOS.

Cachix doesn't require a paid account for public caches like this one would be, you just have to signup through github and get a key. Maybe I can just make you owner of the one I created if aarch64-multiplatform works for both linux and darwin.

I actually don't know if it will work for both or not, I'm new to cross compilation.

That was one of the nixpkgs issues I filed that got closed "won't fix".

The closest issue I could find was this one that's still open:

NixOS/nixpkgs#126829

@ParetoOptimalDev
Copy link

Here's an aarch64 multiplatform binary for testing:

https://github.com/ParetoOptimalDev/elm-format/suites/8023378224/artifacts/344661816

It finished in 2 hours. I reran and it took 40s with the cache.

@ParetoOptimalDev
Copy link

Update: It works on aarch64-linux, but not aarch64-darwin/arm64 on an m1 mac.

@ParetoOptimalDev
Copy link

ParetoOptimalDev commented Aug 29, 2022

Just for completeness I tried building pkgsCross.aarch64-darwin.elmPackages.elm-format in the gihub action and it had infinite recursion encountered (as expected) here.

A workaround could be that when actions/runner-images#2187 is finished, you don't have to use pkgsCross at all and can just build pkgsStatic.elmPackages.elm-format.

Of course you have other otpions at that point, and that run-on-arch-action looks promising as well.

@avh4
Copy link
Owner Author

avh4 commented Feb 24, 2023

Can anyone test running the aarch64 binary here: https://elm-format.avh4.net/manual/0.8.5-424-g9e071c6f/ and see if it works in the Linux ARM64 environment that they need it for?

@avh4
Copy link
Owner Author

avh4 commented Feb 25, 2023

Fixed in #798 The next release (0.8.6) will include official linux-aarch64 static binaries.

Thanks @ParetoOptimalDev for the suggestion of using Nix pkgsCross -- it seems to work great now!

@avh4 avh4 closed this as completed Feb 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants