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

better support for static linking #391

Closed
bos opened this issue May 24, 2012 · 8 comments
Closed

better support for static linking #391

bos opened this issue May 24, 2012 · 8 comments

Comments

@bos
Copy link
Contributor

bos commented May 24, 2012

(Imported from Trac #398, reported by @dcoutts on 2008-11-08)

Generating statically linked binaries on different platforms requires a bit of knowledge about what flags to pass to ghc. It would be nice to just be able to cabal configure --enable-static-executable or something and have that pass the extra -optl-static and whatever ghc options are required.

If it's not possible to generate static binaries it should make some attempt at explaining why.

@bos
Copy link
Contributor Author

bos commented May 24, 2012

(Imported comment by @dcoutts on 2008-11-08)

Should not be too hard at least on common platforms. Just needs a bit of testing. Standalone task for some volunteer.

@antoinelyset
Copy link

+1 I'm currently reviewing Haskell for static linked binaries and I would love to be able to do it, just as in Go. Cross Compilation would be great too :).

@purpleidea
Copy link

+1

@tibbe
Copy link
Member

tibbe commented Oct 15, 2014

I think this is a good idea as well. Anyone care to take a stab at it? I can provide some guidance. Generally you just have to add the --enable-static-executables flag and then output the right GHC flags in https://github.com/haskell/cabal/blob/master/Cabal/Distribution/Simple/GHC.hs.

@gozes
Copy link

gozes commented Dec 16, 2014

+1

1 similar comment
@mcfilib
Copy link

mcfilib commented Jul 16, 2015

+1

@nh2
Copy link
Member

nh2 commented Jul 18, 2018

I'm giving a shot at this now.

nh2 added a commit to nh2/cabal that referenced this issue Jul 18, 2018
Also update the docs for `--enable-executable-dynamic`
as they were slightly misleading.
nh2 added a commit to nh2/cabal that referenced this issue Jul 18, 2018
Also update the docs for `--enable-executable-dynamic`
as they were slightly misleading.
@nh2
Copy link
Member

nh2 commented Jul 18, 2018

I'm giving a shot at this now.

OK done.

nh2 added a commit to nh2/cabal that referenced this issue Jul 18, 2018
Also update the docs for `--enable-executable-dynamic`
as they were slightly misleading.
nh2 added a commit to nh2/cabal that referenced this issue Jul 18, 2018
Also update the docs for `--enable-executable-dynamic`
as they were slightly misleading.
nh2 added a commit to nh2/cabal that referenced this issue Jul 19, 2018
Also update the docs for `--enable-executable-dynamic`
as they were slightly misleading.
nh2 added a commit to nh2/cabal that referenced this issue Jul 20, 2018
Also update the docs for `--enable-executable-dynamic`
as they were slightly misleading.
nh2 added a commit to nh2/cabal that referenced this issue Jul 20, 2018
Also update the docs for `--enable-executable-dynamic`
as they were slightly misleading.
nh2 added a commit to nh2/cabal that referenced this issue Jul 20, 2018
Also update the docs for `--enable-executable-dynamic`
as they were slightly misleading.
23Skidoo pushed a commit to nh2/cabal that referenced this issue Dec 6, 2018
Also update the docs for `--enable-executable-dynamic`
as they were slightly misleading.
23Skidoo pushed a commit to 23Skidoo/cabal that referenced this issue Feb 7, 2019
Also update the docs for `--enable-executable-dynamic`
as they were slightly misleading.
phadej added a commit to phadej/cabal that referenced this issue Feb 9, 2019
phadej added a commit to phadej/cabal that referenced this issue Feb 9, 2019
phadej added a commit to phadej/cabal that referenced this issue Feb 9, 2019
phadej added a commit to phadej/cabal that referenced this issue Feb 17, 2019
nh2 added a commit to nh2/cabal that referenced this issue Nov 13, 2019
* 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.

Cherry-Picked-From: cc4ae8a

Its commit got squashed in:

Pass --static to pkg-config on --enable-executable-static.

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.

Also this commit got squashed in:

Add `--enable-executable-static` flag. Fixes haskell#391.

Also update the docs for `--enable-executable-dynamic`
as they were slightly misleading.

Cherry-Picked-From: c9f02b2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants