-
Notifications
You must be signed in to change notification settings - Fork 843
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
Provide statically linked binary for Linux/AArch64 #6142
Comments
I am a little confused, and this is the source of my confusion:
The AArch64 Stack gets built through three main files:
I can't see in any of those three key files where |
@hasufell is the master of building things for different platforms. Perhaps he can help bring some clarity. |
Pandoc, which is built using Cross references: |
@mpilgrem the release for linux is built in an alpine container (which uses musl):
The Line 516 in 62f6709
We could do this theoretically as well for ARM64 Linux. I'm not too sure how the A static binary solves two things:
The second part is moot if there are no corresponding GHC bindists. So my opinion is that we need proper GHC bindists for musl ARM64, so that stack and ghcup can add it to its metadata and everyone can build static ARM64 binaries without docker tricks. I can raise this with GHC developers in the next meeting. But overall, I'm not sure how big the gain is for all of this. But yes, you could probably do this with only a specialized docker image. |
Couldn't this be bootstrapped from
Thank you. Alpine Linux (musl libc) is made to produce statically linked binaries. Such binaries are relocatable to on any [compatible1] Linux distribution. Footnotes
|
Proper GHC bindists for Linux (AArch64) Alpine releases would also resolve haskell/docker-haskell#22. |
I'm not sure I understand your proposal. The normal use case of stack, ghcup and all other tooling has nothing to do with docker, but relies on those tools to download and install a bindist that will work on said platform. I think we should support the main use case first. It might not be hard to convince GHC devs to provide another alpine variant, since alpine x86_64 is already supported. |
@hasufell, thank you for your explanations. I've fixed Stack's static Cabal flag documentation. Notes for my own benefit:
|
@benz0li, I think I have caught up. If I understand correctly, Will the current (non-static) Linux/AArch64 version of Stack 2.11.1 run in that environment? I need a working (recent) version of Stack in order to build Stack. If yes, then can I simply use 'non-static' Stack to build a 'static' Stack in that environment by passing |
|
Yes, the multi-arch (
🆗
No, it does not. On a machine (Linux/AArch64) with $ docker run --rm -ti glcr.b-data.ch/ghc/ghc-musl:9.2.7 bash Inside the container: $ curl -sSL https://github.com/commercialhaskell/stack/releases/download/v2.11.1/stack-2.11.1-linux-aarch64-bin -o /usr/bin/stack
$ chmod +x /usr/bin/stack $ stack --version
bash: /usr/bin/stack: No such file or directory $ ldd /usr/bin/stack
/lib/ld-linux-aarch64.so.1 (0xffffa0122000)
libpthread.so.0 => /lib/ld-linux-aarch64.so.1 (0xffffa0122000)
libz.so.1 => /lib/libz.so.1 (0xffffa00fb000)
librt.so.1 => /lib/ld-linux-aarch64.so.1 (0xffffa0122000)
libutil.so.1 => /lib/ld-linux-aarch64.so.1 (0xffffa0122000)
libdl.so.2 => /lib/ld-linux-aarch64.so.1 (0xffffa0122000)
libgmp.so.10 => /usr/lib/libgmp.so.10 (0xffffa0085000)
libc.so.6 => /lib/ld-linux-aarch64.so.1 (0xffffa0122000)
libm.so.6 => /lib/ld-linux-aarch64.so.1 (0xffffa0122000)
Error relocating /usr/bin/stack: fcntl64: symbol not found
Stack may also be built using Cabal: See #6141 |
I have updated the instructions at #6141 (comment) to build a statically linked and stripped Stack executable for both Linux/x86_64 and Linux/AArch64 using Cabal and the multi-arch ( Statically linked because of
ℹ️ This only works with Stripped because of |
I created a repo to build aarch64 statically-linked binary with CircleCI and aarch64 alpine docker: https://github.com/bjin/stack-aarch64-static |
@hasufell I created a multi-arch1 docker image2 containing an unsupported, statically linked binary at This binary is now part of the following multi-arch1 docker images providing unofficial GHC builds (Alpine-based, musl libc; build flavour:
Stack builds fine with e.g. Footnotes |
The unsupported binary in the |
Fix #6142 Build statically-linked Linux/Aarch64 Stack
The binary for Linux/x86_64 is statically linked
whereas the binary for Linux/AArch64 is not.
$ stack --version Version 2.11.1, Git revision c1167a6abc3f4978ccded5ba0246a57387da0e2f aarch64 hpack-0.35.2 $ file /usr/local/bin/stack /usr/local/bin/stack: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[xxHash]=3d8f9d614342c40f, stripped
The text was updated successfully, but these errors were encountered: