Skip to content
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

Patch cabal to pass --static flags to pkg-config #62

Open
nh2 opened this issue Oct 21, 2019 · 5 comments
Open

Patch cabal to pass --static flags to pkg-config #62

nh2 opened this issue Oct 21, 2019 · 5 comments
Labels
enhancement New feature or request

Comments

@nh2
Copy link
Owner

nh2 commented Oct 21, 2019

pkg-config takes a --static flag to output .a files for --libs. We currently add those manually in static-haskell-nix.

Instead, we should teach cabal to pass it, given that .cabal files can specify pkg-config dependencies.

Hopefully we can then get rid of pkg-config related overrides in static-haskell-nix and fundamentally fix issues like #57, so that Haskell libraries "remember" which static system libraries they need.

@nh2 nh2 added the enhancement New feature or request label Oct 21, 2019
@nh2
Copy link
Owner Author

nh2 commented Nov 8, 2019

At NixCon I found that this requires adding a new field to ghc-pkg's .conf files, like extra-libraries-static, because libraries can't know at the time they invoke pkg-config whether they will eventually be linked statically or not, so we must carry along both sets of flags.

@nh2
Copy link
Owner Author

nh2 commented Nov 9, 2019

Before realising the above, I made a WIP for passing --static to pkg-config from cabal only:

https://github.com/nh2/cabal/tree/pkg-config-static-flag

Today I also made a WIP for the more significant change of adding the relevant fields to .conf files:

https://github.com/nh2/cabal/tree/extraLibrariesStatic-field

I still have to implement the GHC side.

@nh2
Copy link
Owner Author

nh2 commented Nov 12, 2019

Blocking Hadrian issue that prevenets me from adding fields to Cabal:

https://gitlab.haskell.org/ghc/ghc/issues/17468

@alexbiehl
Copy link

https://gitlab.haskell.org/ghc/ghc/issues/17468 has been fixed!

@alexbiehl
Copy link

alexbiehl commented Aug 5, 2020

@nh2 I am picking this up again. Can you elaborate what changes need to happen on the GHC side? Looking at

https://github.com/nh2/cabal/tree/extraLibrariesStatic-field
I still have to implement the GHC side.

in #62 (comment).

I was under the impression that Cabal would control the linker line and that GHC wouldn't need to do anything special with extra-libraries-static?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants