-
Notifications
You must be signed in to change notification settings - Fork 146
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 darwin-arm64 release binaries #723
Comments
This issue is blocking even the possibility of github actions support: actions/runner-images#2187 |
I guess more importantly, this is blocked by ghc support for arm64: https://gitlab.haskell.org/ghc/ghc/-/issues/18664 |
This should be possible now with recent GHC versions. GHC 9.2.1-rc1 changelog mentions:
|
I think ghc 8.10.7 also supports arm64. (getting to ghc 9 will be additional work, see #725) |
See https://github.com/mpizenberg/elm-test-rs/pull/91/files#diff-b803fcb7f17ed9235f1e5cb1fcd2f5d3b2838429d4368ae4c57ce4436577f03fR38-R42 regarding github CI darwin-arm64 runners |
Is it worth considering homebrew as a way of distributing arm elm-format binaries? Brew is widely used, and supports building apple silicon "bottles". There is an existing brew elm-format formula (https://github.com/Homebrew/homebrew-core/blob/master/Formula/elm-format.rb) but it currently I have tried updating this formula, but my experience building haskell packages is pretty limited, and I got myself into rather a tangle:
|
@mloughran GHC 8.10.7 is able to compile darwin-arm64 binaries. |
@Janiczek Thanks, I saw that too – however the |
I'm not familiar with how homebrew works internally... Do you know which version of ghc it provides for folks that install ghc/haskell with homebrew? elm-format-0.8.5 still used ghc 8.10.4, so I'd expect bumping that to 8.10.7 would probably work fine. (Though the |
My understanding is that when building from source brew simply creates a tmp directory and executes the commands in the
This seems promising. Running |
Hmm, looks like some of the dependencies are conflicting. A quick thing to try would be to have the brew script delete the |
Ah, yeah, it's because ghc-8.10.7 uses a different version of I made a branch that updates the freeze file https://github.com/avh4/elm-format/compare/ghc-8.10.7#diff-0b691f96fc8719139319225235e815688efd0423a88f3a397c994c05bf5a0c7c= but I think you could just have the brew script delete |
Oh, though if you're building with |
Thanks. Tried building with the ghc-8.10.7 branch, now getting the following build output: https://gist.github.com/mloughran/95d973a11228ae97dc9a6d9a4b28f89c. No idea what all the LLVM warnings are about. Not sure at this stage if the issue is my system or apple silicon... – brew formula changes at Homebrew/homebrew-core@master...mloughran:homebrew-core:elm-format-apple-silicon if anyone else wants to have a go! |
Is that log from you running the brew formula locally? Or from brew's CI system? I found this: https://haskell-cafe.haskell.narkive.com/WxaFromX/ghc-could-not-execute-opt which seems to match the "ghc: could not execute: opt" message. I guess you need |
Running Adding llvm as an explicit dependency was indeed required. Do the last few lines of https://gist.github.com/mloughran/c989268f0445785127fbb9cbc6f96e10 make any sense to you? |
Oh, yep, I guess I gave bad advice before... Does homebrew actually clone the real git repo at the given tag? If homebrew doesn't actually clone the git repo, then you can |
Here's some addition to the workaround building M1 binary on my local M1 machine. To fix export C_INCLUDE_PATH="`xcrun --show-sdk-path`/usr/include/ffi" To fix platform :: Platform
platform =
case (System.Info.os, System.Info.arch) of
("linux", "x86_64") -> Linux
("darwin", "x86_64") -> Mac
("darwin", "aarch64") -> Mac -- Add this line
("osx", "x86_64") -> Mac
("mingw32", "x86_64") -> Windows
("win32", "x86_64") -> Windows
other -> error ("unhandled operating system: " ++ show other) To add up @avh4 's original comment,
Then, I could have |
Thanks to self-hosted runners provided by Lamdera, this has been implemented in #784 A resulting binary of the current development branch can be found at the bottom of this page: https://github.com/avh4/elm-format/actions/runs/4140939854 (If anyone wants to pursue distribution of elm-format through other package managers, such as homebrew, please open a new issue for that.) |
I don't have my own M1 hardware to build on, so we're waiting for Github Actions to support M1.
Workaround
You can build your own darwin-arm64 binaries as follows:
TODO... You'll still need changes from #769 for this to work.
The final binary will be
./_build/elm-format
Probably the easiest way to do this is to hope that github hosted runners get support for darwin-arm64, and we can build the binaries on CI.
External blockers:
Other notes:
keywords: arm
The text was updated successfully, but these errors were encountered: