-
-
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
haskell: make generic builder follow compiler’s shared config #42311
haskell: make generic builder follow compiler’s shared config #42311
Conversation
ebf722c
to
80b7eb0
Compare
Added 8.2.1-binary |
enableShared in generic-builder.nix should default to what the GHC compiler was compiled with. Add a passthru to all of the GHC compilers to hold the value of enableShared. If enableShared is not set in the GHC we just use false as the default value for enableSharedLibraries. Note: I may have missed some compilers. Only GHC & GHCJS are covered by this commit but this shouldn’t break evaluation of anything else.
80b7eb0
to
fd7a6ea
Compare
Why should it? |
My understanding is that if your compiler wasn't compiled with "enableShared", setting "enableSharedLibraries" to true, will break things. |
is always true today. I gather this is because old GHC didn't support dynamic linking, so that reads "true where possible". If anyone has a custom compiler that doesn't support dynamic linking, they can do
The point being deduplicating the logic like this doesn't tie our hands. |
I see an argument to be made that you'd want things to break in that case. The |
Feel free to revert if you disagree. This was motivated by the need to have "enableSharedLibraries" set to false in prebuilt Android & iOS (which is the default for their config) and they are broken otherwise. I felt like this approach would avoid the most duplication but there are certainly other ways to accomplish this. If you do want to revert I hope it is okay to add an extra condition to enableSharedLibraries in generic-builder.nix. |
Yeah we can revert this in the interim, but let me continue to argue for this approach. @peti so first of all, are you OK with us adding the cross exceptions to the generic builder default? If we do, then the default becomes a verbose condition that doesn't to me express a policy other than "build shared libraries where possible". (Any other interpretation would strike me as an "overfit" one.) If we don't, then users must manually instruct generic-builder even when they don't actually care and just want working builds. And even in the leave-as-is case, I still read the default that way. It makes no sense that below a certain version most people just don't want shared libraries. It makes far more sense that most people always want shared libraries, but also have static libraries than none at all. This PR exactly formalizies that second generalization of people's desires with the new default. |
Oh, a change we could make is flip the I do see how a missing attribute causing static builds is a subtle and not-declarative-in-spirit default. |
I just would have liked to have this conversation before the merge, not after. Anyway, I don't feel strongly enough about this issue to bother reverting those changes now. Both schemes have their advantages, and the state we have now feels just fine. |
enableShared in generic-builder.nix should default to what the GHC
compiler was compiled with. Add a passthru to all of the GHC compilers
to hold the value of enableShared. If enableShared is not set in the
GHC we just use false as the default value for enableSharedLibraries.
Note: I may have missed some compilers. Only GHC & GHCJS are covered
by this commit but this shouldn’t break evaluation of anything else.