Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pkgs/development/haskell-modules/configuration-common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1068,3 +1068,14 @@ self: super: {
in {
inherit amazonka amazonka-core amazonka-test;
})

//

# The actual Cabal library gets built while building its `Setup.hs`.
(let
inherit (pkgs.lib) filterAttrs flip mapAttrs hasPrefix;
cabals = filterAttrs (n: v: hasPrefix "Cabal_" n) super;
fixCabal = n: v: addSetupDepends v [ self.mtl self.parsec ];
in
mapAttrs fixCabal cabals
)
17 changes: 4 additions & 13 deletions pkgs/development/haskell-modules/generic-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,8 @@ let
"--configure-option=--host=${hostPlatform.config}"
] ++ crossCabalFlags);

useSeparateSetupDb = setupHaskellDepends != [] || isCross || isGhcjs;

setupCompileFlags = [
(optionalString (!coreSetup) "-${nativePackageDbFlag}=${
if useSeparateSetupDb
then "$setupPackageConfDir"
else "$packageConfDir"
}")
(optionalString (!coreSetup) "-${nativePackageDbFlag}=$setupPackageConfDir")
(optionalString (isGhcjs || isHaLVM || versionOlder "7.8" ghc.version) "-j$NIX_BUILD_CORES")
# https://github.com/haskell/cabal/issues/2398
(optionalString (versionOlder "7.10" ghc.version && !isHaLVM) "-threaded")
Expand Down Expand Up @@ -270,10 +264,8 @@ stdenv.mkDerivation ({
echo "Build with ${ghc}."
${optionalString (hasActiveLibrary && hyperlinkSource) "export PATH=${hscolour}/bin:$PATH"}

'' + (optionalString useSeparateSetupDb ''
setupPackageConfDir="$TMPDIR/setup-package.conf.d"
mkdir -p $setupPackageConfDir
'') + ''
packageConfDir="$TMPDIR/package.conf.d"
mkdir -p $packageConfDir

Expand All @@ -284,14 +276,13 @@ stdenv.mkDerivation ({
# dependencies for the build machine.
#
# pkgs* arrays defined in stdenv/setup.hs
+ (optionalString useSeparateSetupDb ''
+ ''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ericson2314 I think this is causing the ARGMAX issue lately - this gives us way more --extra-*-dirs than we used to have. Can we be smarter at avoiding duplicates here? buildPkgDb will add to arg length much more than ordinary -L stuff.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a later PR, isn't it changed so that --extra-* flags are not made for the setup.hs package db?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok but the separate setup db thing could still be an issue. Here is the line that is hitting argmax:

ghc -package-db=/var/folders/l4/v2k_52x55r3_bf4cty3g4bg00000gn/T//setup-package.conf.d -j4 -threaded --make -o Setup -odir /var/folders/l4/v2k_52x55r3_bf4cty3g4bg00000gn/T/ -hidir /var/folders/l4/v2k_52x55r3_bf4cty3g4bg00000gn/T/ Setup.hs

GHC must not know how to deal with ARGMAX correctly in package-db.

Copy link
Member Author

@Ericson2314 Ericson2314 Jul 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK huh that's really weird because I'd suspect that package db is super small. I think the real issue is having ghc as two different types of deps on native causes the setup hook to be run twice, which then without strict deps effectively causes the env hooks to be run twice more than they were without strict deps already.

for p in "''${pkgsBuildBuild[@]}" "''${pkgsBuildHost[@]}" "''${pkgsBuildTarget[@]}"; do
${buildPkgDb nativeGhc.name "$setupPackageConfDir"}
done
${nativeGhcCommand}-pkg --${nativePackageDbFlag}="$setupPackageConfDir" recache
'')

# For normal components
''
# For normal components
+ ''
for p in "''${pkgsHostHost[@]}" "''${pkgsHostTarget[@]}"; do
${buildPkgDb ghc.name "$packageConfDir"}
Expand Down