-
-
Notifications
You must be signed in to change notification settings - Fork 369
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
Don't statically link binaries against glibc/system libraries. #2431
Comments
thanks for the proposal, not an expert in linux but it sounds very reasonable |
They will not work on Other than that we should usually be able to rely on ABI compatibility for |
ok, so one plan could be prepare an extra binary for linux for a fixed ghc version (8.10.7?) in ci using those flags and dogfood it/offer it to people hitting the relevant bugs |
Like I said, statically linking |
maybe i am being too cautious here for wanting to do it progresively |
FTR: I made a naive attempt to build haskell-language-server against musl in #429 (comment) (second part), but it did not work as dynamic loading is not supported. |
I think so, yes. If you want to statically link against Another alternative is to accept dynamic linking against If I were you, I would just do what the rest of the world does and build on a distribution like Alpine that uses musl. This will greatly simplify things. |
Not if it requires relying on the GHC linker for dynamic linking. We need to leave that behind. |
ok the plan then will be build Linux binaries with the flags suggested by @wz1000 against the older Ubuntu provided by GitHub vms |
Another way to link against |
Let's follow Zubin and Ben's recommendation and switch to |
Closed via #2463 |
Currently static HLS binaries for linux are built using
--enable-executable-static
. This makes cabal build fully static binaries, but statically linkingglibc
is not a supported configuration byglibc
. In addition to this, glibc mismatches between the CI images and user environments can lead to many problems, including:Assertion freesize < size failed
on a fairly minimal example #2328I also believe many of the segfaults reported on TH code have this as the underlying cause rather than bugs with the RTS linker (which do exist, but they aren't responsible for all of the pain).
Instead, we should be using the following configuration for building releases:
This uses the (vanilla, static) way to build and link Haskell code, but system libraries will still be linked in dynamically.
The difference between the binaries can be observed like so:
By contrast, a fully dynamic build will link against a bunch of haskell libraries in
~/.cabal/store
anddist-newstyle/
Another option is to statically link against
musl
on an alpine image, but this might still run into problems with loading user code (for TH and plugins) linked against mismatching system libraries. If we do take this route, we will have to bundle a whole GHC distribution (including libraries) with HLS releases, and ensure that hie-bios/cabal/stack uses the bundled GHC distribution to compile all the dependencies of the user's project.This is made more complicated given that
cabal
will share the package stores of different compilers as long as they have the sameghc --version
.The text was updated successfully, but these errors were encountered: