-
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
Alex/library dirs static and extra libraries static #7536
Alex/library dirs static and extra libraries static #7536
Conversation
00f772e
to
de15a94
Compare
@Mikolaj I think this is ready for review! |
Splendid. Am I right guessing this is supposed to help in situations like this:
which is what I needed to write in order to link SDL [edit; SDL2_TTF to be precise] application statically? (and failed, see see utdemir/ghc-musl#14 (comment)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really complete. Thanks @alexbiehl
Also, do you mind adding a changelog entry? |
This improves static building of packages with pkg-config depends, by using the pkg-config feature designed for just that. It results in more `-l` flags being emitted by `pkg-config --libs`, namely those of all recursive `.a` file dependencies.
* WIP: Still need to update ghc to use the new `libraryDirsStatic` and `extraLibrariesStatic` fields in `InstalledPackageInfo` for linking. * WIP: Adding -L paths to .a libs in .conf files will likely increase nix closure size for dynamically linked Haskell packages because if pkg-config finds an `-a` file, the path to it will be remembered. (That only has an impact if the .a file is in a split-output from the .so file.) Perhaps we make the feature that `pkg-config --static` is called opt-outable. On the other hand Haskell libs always carry their .a files, so pulling a few system `.a` files more shouldn't make much of a difference. So this opt-out should probably be an extra feature for later, if at all.
de15a94
to
81f98c4
Compare
@emilypi Done! |
@Mikolaj That's exactly right. For now this PR doesn't do very much. Once merged, I will bump Cabal for GHC, add a new flag to create static exes where I will make use of the newly added field in the InstalledPackageInfo. Only then we will have full end-to-end support for more convenient static linking. We are so close!! |
@alexbiehl: I think @emilypi meant something like that: https://github.com/Mikolaj/cabal/blob/91195e844e44f585298c0cb78806103904c4f9bb/changelog.d/pr-7510 But perhaps your way of adding the changelog is fine, too, can't tell. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job. Looking forward to GHC changes.
This PR is the continuation of #6935, in particular the next step in the plan laid out by nh2/static-haskell-nix#62 (comment).
The commits in this PR were kindly developed by @nh2, I just rebased and adjusted here and there for recent Cabal developments.
We need to see how much adjustment we need for the testsuite to pass. Once that's done the I would prepare a patch for GHC honouring the new fields for static linking.
Please include the following checklist in your PR:
Please also shortly describe how you tested your change. Bonus points for added tests!