-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
Multiple outputs for haskell ecosystem #4504
Comments
Yes, I completely agree. It's probably not even hard to implement that in the generic Cabal builder. |
👍 |
@peti Maybe this has been fixed already? |
No, we don't support multiple outputs at the moment. |
#10541 could also be improved. |
#8390 has interesting discussion about this subject. |
b) is partially addressed at #16167 (at least for 7.10.x and 8.0.1) |
Testing a patch to move libraries in a separate output now. Will report back soon. Don't know how to split static and dynamic libraries apart, though. |
Do we build static libraries by default? Should we? @peti |
We build both shared and static libraries by default.
|
Generally in nixpkgs we only build shared and static you have to request specifically, is there a reason haskell is different? |
So far, Cabal used to implode when you tried to run builds that produce dynamic libraries only. Not sure how well recent version fare in that regard. Also, static libraries are very useful to produce binaries that don't depend on GHC at runtime.
|
But if we do this split, that latter won't be an issue, right? Since having the runtime statically linked vs dynamically shouldn't make a huge difference in runtime deps (and will be much less wasteful if you have multiple binaries) |
There is also the issue of cabal-generated source files on build which can be (and are!) referenced by packages to get stuff from different paths, e.g. https://hackage.haskell.org/package/gitit-0.12.1.1/docs/src/Paths_gitit.html. |
filename_stuff :: String wow |
Starting with ghc 8.0.2 |
The Paths_pkgname module problem is real. A lot of haskell packages install data and use Paths_pkgname to access it. So even if you compile executable statically, you can still get 1.5GiB closure if you are not careful. { args
, splitDataOutput ? false # backwards compatible
} Conditional mutiple-outputs and configure flags {
outputs = if splitDataOutput then [ "out" "data"] else ["out"];
defaultConfigureFlags = [
"--verbose" "--prefix=$out" "--libdir=\\$prefix/lib/\\$compiler" "--libsubdir=\\$pkgid"
(optionalString splitDataOutput "--datadir=$data/\\$datasubdir")
other stuff ];
} If it turns out that older cabal or ghc has problems with it, we can always back out. |
Ah, disregard that. Paths_pkgname it also has libdir in there. |
I'd hope we can split With dead code elimination, most of the stuff in |
Now if only we could do GHC itself... Great work guys! |
I think we should close this and open a new issue for GHC if wanted. |
Haskell closures could be greatly reduced if:
a) the shared libraries that come with ghc that all haskell shared libraries link to were in a separate output from the compiler, and
b) documentation were in a separate output from the binary/library being built
cc @peti
The text was updated successfully, but these errors were encountered: