-
Notifications
You must be signed in to change notification settings - Fork 697
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 cabal-install
releases
#4941
Comments
Yep, makes sense. I'll try to do that for the next release. Can you point me to some resources on how to build statically-linked Haskell binaries? I know of https://www.fpcomplete.com/blog/2016/10/static-compilation-with-stack. |
@23Skidoo I built a static For your convenience, you may use |
@TerrorJack Is there a similar 32-bit image? |
Same as @TerrorJack, I use this dockerfile https://github.com/erebe/wstunnel/blob/master/Dockerfile based from stock alpine images to build static binary. (thanks to @mitchty) The blog post from fpcomplete is outdated, as @TerrorJack said only adding ld-options: -static in the cabal file of the project do the tricks. I was planning to do a blog post to explain how to do it properly in order to avoid the hack explained in the fpcomplete blog post, but I was hoping for this issue #4925 to be resolved before doing it |
@TerrorJack @erebe @mitchty Is it possible to use a 32-bit binary GHC distribution from https://www.haskell.org/ghc/download_ghc_8_0_2.html#linux_i386 with a 32-bit Alpine Docker image or do I need to build GHC myself? |
@23Skidoo You need to build it yourself, and since there's no ghc binary package for i386, you need to cross-compile it in a glibc based distro. |
:-( |
I have it on my list to finish getting ghc ported/cross-compiled to the rest of alpine's archictectures, i386 would probably be the easiest of them. What kind of timeframe were you looking at? |
@mitchty That's great to hear! Thank you for working on this. I think that the next major release of |
@23Skidoo okie dokie, i'll poke around at the cross compiling again, cross compiling ghc is... not the most intuitive thing to do to be honest. And getting x86 as an arch has been asked by at least a few people, but just wasn't a priority for the initial port. But compared to arm it shouldn't be too crazy. If I get it up and running I should be able to build alpine linux ghc bindists that you could use until apk packages are ready/built (or after for that matter). |
@mitchty Thanks a lot! |
@mitchty Any updates? The 2.2 cabal-install release will be out in ~2 weeks, would be cool to have statically-linked 32-bit binaries for it as well. |
Musl cross landed (on staging) in nixpkgs. I can look into this now. |
@Ericson2314 Are you still interested in this? Would be nice if you (or someone) could produce static |
Yeah I'm still interested. It depends on NixOS/nixpkgs#37598 being resolved, but I can assist with that. |
Great. |
Nix now makes it possible to build fully statically linked This is based upon, among others, @Ericson2314's work mentioned just above. I have completed such a build here |
Quick note: It's not enough to naively think one can build statically linked executables and things will just work, as library routines like |
We can mark statically-linked |
@23Skidoo offering statically linked cabal-install binaries with a "use at your own risk" disclaimer pointing out the potential problems sounds good to me. |
@hvr What do you mean by that? Correspondingly I'm also not quite sure what
would look like in @23Skidoo's comment.
Yes, NSS is a glibc specific feature. Probably not relevant unless somebody wants to resolve resolve |
Based on some discussion in haskell/ghcup#68 it sounds like this should be closed, given that http://downloads.haskell.org/cabal/cabal-install-2.4.1.0/cabal-install-2.4.1.0-x86_64-alpine-linux-musl.tar.xz is now available. |
That executable is not statically linked:
|
@nh2 I see some steady improvements in static-haskell-nix. I understand that it should in theory be possible now to build a statically-linked cabal-install. Are there any guidelines / blog posts describing how a Haskell software can benefit from static-haskell-nix? In particular, Cabal is using GitLab CI for making releases this day (see |
IIRC, the Alpine binaries on gitlab are statically linked, but they are not totally static. IIRC, they require pthreads that makes HEAD GHC fail on my ancient Ubuntu (cabal probably uses an older version of the pthreads so it doesn't fail). Unless I'm misdiagnosing why the binaries from HEAD GHC snapshots fail for me. |
At least, ❯ wget https://downloads.haskell.org/~cabal/cabal-install-3.8.1.0/cabal-install-3.8.1.0-x86_64-linux-alpine.tar.xz
...
❯ tar -xf cabal-install-3.8.1.0-x86_64-linux-alpine.tar.xz
...
❯ ldd cabal
not a dynamic executable
|
Yeah, I hope alpine is fine for most users. Thank you for the gardening. :) Closing. |
Current binary releases of
cabal-install
are not statically linked, thus depending onglibc
, which makes them unusable onmusl
-based distros like Alpine Linux. It'd be nice if statically-linked binary releases (at least for x64 Linux) can be provided forcabal-install-2.0.0.1
and future versions.The text was updated successfully, but these errors were encountered: