Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Back-port Haskell-related improvements from stdenv-updates.
* There now is full support for building Haskell packages as shared libraries for GHC versions 7.4.2 or later. The Cabal builder recognizes the following attributes: - enableSharedLibraries configures Cabal to build of shared libraries in addition to static ones. This option requires that all dependencies of the package have been compiled for use in shared libraries, too. - enableSharedExecutables configures Cabal to prefer shared libraries when linking executables. The default values for these attributes are arguments to the haskellPackages expression. * Haskell builds now run in a LANG="en_US.UTF-8" environment to avoid plenty of build and test suite errors. Without this setting, GHC seems unable to deal with the UTF-8 character encoding that's generally considered standard in the Haskell world. * The Cabal builder supports a new attribute 'testTarget' to specify the exact set of tests to be run during the check phase. * The ghc-wrapper attribute ghcVersion has been removed. Instead, we use the ghc.version attribute, which exists in unwrapped GHC derivations, too.
- Loading branch information
Showing
21 changed files
with
184 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
d64917a
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 seems to cause many build problems on Hydra. I see mainly i686-linux and darwin fail.
d64917a
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.
Hydra failed to compile GHC because the build machines ran out of memory (probably because they were compiling several versions of GHC at the same time due to my commit). GHC is a dependency for several hundred other builds. I've asked to please restart those GHC builds, but apparently no-one had time to do it yet. I can't do it, since I don't have an account on Hydra.
d64917a
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.
I'm sorry, I was probably too tired when writing this. I did read the e-mail a few days before, etc.
d64917a
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.
@peti I don't completely understand where this is coming from, but I'm having trouble building my old environments now due to collision errors. In particular, I can no longer have the "haddock" package in an environment (I get a collision between the haddock binary from ghc and the one provided by the package; but what if I need the haddock library?). I also just now got a collision between "runhaskell" as provided by ghc and ghc-wrapper which is even more confusing to me.
d64917a
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.
@kosmikus, the behavior of the wrapper has changed. Versions prior to this commit included only a hand-picked subset of the wrapped packages' directory paths into $out -- mostly just the Haskell libraries. In the new version, every path that's part of "packages" ends up being in $out.
Like everything else, this change comes with pros and cons. One obvious disadvantage is that now some collisions occur, which didn't occur before, i.e. the "haddock" binary provided by ghc collides with the one from the haddock library. Furthermore, the ghc-wrapper that's propagated by "haskellPlatform" now collides with the ghc script that this wrapper provides.
The advantage of the new behavior is that all files provided by the library packages are visible in the derivation. If you'd wrap "ghcMod", then the Haskell library as well as "bin/ghc-mod", "share/emacs/site-lisp", and "share/doc/ghc-mod-3.1.3/html" are all included in $out! The previous version of the wrapper wouldn't have picked those files up (unless someone would have manually extended the script to do so).
One might argue that the old wrapper ran into the same collisions as the new one, it just didn't report them. If you'd use the old wrapper to wrap "haddock", then there'd still be a collision between the two versions of the binary, but the old wrapper would just silently choose the binary from GHC without saying anything.
Clearly, we need a solution for this "haddock" and "haskellPlatform" issue. Here are possible solutions I can think of:
Remove bin/haddock from $ghc to avoid the collision with the haddock library.
Allow people to instantiate the wrapper passing a flag "allowCollisions = true", and have the wrapper pick up files in the order in which they're specified in the packages list so that the last occurance wins. This would change the interface of the ghcWithPackages function, though, which currently doesn't accept a `dictionary argument.
Remove 'ghc' from 'propagatedBuildInputs' in haskellPlatform.
Modify ghcWithPackages to filter ghc-wrapper from the list of to-be-wrapper packages.
What do you think?
d64917a
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.
Referencing #1161 from here.
d64917a
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.
I think for now it would make sense to at least exclude the binaries that cause conflicts. I for one would like to keep haskellPlatform in my environment definition without having to specify every single participant package other than GHC.
It might also make sense to have an overridable flag in haskellPlatform whether to include/export GHC.
d64917a
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.
With regard to Haskell Platform, we have two separate use cases:
Some users want to install Haskell Platform X.Y.Z. That is GHC plus a well-defined set of libraries, and all those packages come in very specific versions.
Other users want to install a GHC version of their choice that knows about all those libraries that are in Haskell Platform, but they don't care whether the respective version numbers match the HP standard to the last digit. This use case treats HP more like a sort of convenient "default environment" which is likely to include all basic building blocks needed by the discerning Haskell hacker.
Now, the current
haskellPackages_ghcXYZ.haskellPlatform
attribute serves use case (1). These expressions conform (mostly) the standard, and they include exactly those parts that HP say they would -- including the compiler.For use case (2), however, these attributes are inappropriate. Suppose I wanted to instantiate GHC 7.0.4 together with the libraries from the latest HP standard. Then I'd write:
But this is clearly non-sense, because HP 2013.2.0.0 includes GHC 7.6.3, so what does it mean to instantiate it with GHC 7.0.4? Indeed, the ghcWithPackages wrapper won't instantiate this derivation precisely because the two GHC instances collide.
So what we ought to do in my humble opinion is to provide two separate solutions for those two use cases. To serve use case (2), we should have simple lists in haskellPackages_ghcXYZ that simply gather the parts of the respective HP version for easy re-use:
For use case (1), however, there should be appropriate packages in the top-level:
This re-factoring would come with a (significant) additional benefit: The Haskell Platform derivations we currently have don't interact nicely with user-land
cabal-install
, because ghc-wrapper does not. The ghcWithPackages wrapper coexists with cabal-install just fine, though, which would make this setup more robust to use for beginners.d64917a
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.
I'll have to look at all of this in more detail soon. For now, I've reverted to the pre-stdenv-updates version for all my systems, as the changes turned out to completely break my workflow.
d64917a
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.
Commit 0e831bd adds an adapted version the old wrapper code again. This should allow you to use
ghcWithPackagesOld
to get the previous behavior.d64917a
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.
@kosmikus, @aristidb, and everyone else who has reverted back to
ghcWithPackagesOld
, could you please check that the following re-implementation ofghcWithPackagesOld
works fine for you and let me know what you find? The patch is very cheap to build -- testing it is not much effort.