Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ef06638832a2
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f2878422ca1d
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on May 5, 2017

  1. haskell: work around linker limits on Mac OS X Sierra.

    The Sierra linker added a limit on the number of paths that any one
    dynamic library (`*.dylib`) can reference.  This causes problems when
    a Haskell library has many immediate dependencies (#22810).
    
    We follow a similar fix as GHC/Cabal/Stack: for each derivation,
    create a new directory with symlinks to all the dylibs of its immediate
    dependencies, and patch its package DB to reference that directory
    using the new `dynamic-library-dirs` field.
    
    Note that this change is a no-op for older versions of GHC, i.e., they will
    continue to fail on some packages as before.
    
    Also note that this change causes the bootstrapped versions of GHC to be
    recompiled, since they depend on `hscolour` which is built by
    `generic-builder.nix`.
    
    Tested by building the `stack` binary as described in #22810.
    
    (cherry picked from commit 7131e06)
    judah authored and shlevy committed May 5, 2017
    Copy the full SHA
    92ed6cb View commit details
  2. Fix use of isDarwin conditionals.

    (cherry picked from commit 2caa7b8)
    judah authored and shlevy committed May 5, 2017
    Copy the full SHA
    f287842 View commit details
Showing with 39 additions and 1 deletion.
  1. +17 −0 pkgs/development/haskell-modules/generic-builder.nix
  2. +22 −1 pkgs/development/haskell-modules/with-packages-wrapper.nix
17 changes: 17 additions & 0 deletions pkgs/development/haskell-modules/generic-builder.nix
Original file line number Diff line number Diff line change
@@ -227,6 +227,23 @@ stdenv.mkDerivation ({
configureFlags+=" --extra-lib-dirs=$p/lib"
fi
done
'' + (optionalString stdenv.isDarwin ''
# Work around a limit in the Mac OS X Sierra linker on the number of paths
# referenced by any one dynamic library:
#
# Create a local directory with symlinks of the *.dylib (Mac OS X shared
# libraries) from all the dependencies.
local dynamicLinksDir="$out/lib/links"
mkdir -p $dynamicLinksDir
local foundDylib=false
for d in $(grep dynamic-library-dirs $packageConfDir/*|awk '{print $2}'); do
ln -s $d/*.dylib $dynamicLinksDir
done
# Edit the local package DB to reference the links directory.
for f in $packageConfDir/*.conf; do
sed -i "s,dynamic-library-dirs: .*,dynamic-library-dirs: $dynamicLinksDir," $f
done
'') + ''
${ghcCommand}-pkg --${packageDbFlag}="$packageConfDir" recache
runHook postSetupCompilerEnvironment
23 changes: 22 additions & 1 deletion pkgs/development/haskell-modules/with-packages-wrapper.nix
Original file line number Diff line number Diff line change
@@ -96,7 +96,28 @@ symlinkJoin {
makeWrapper ${ghc}/bin/$prg $out/bin/$prg --add-flags "${packageDBFlag}=${packageCfgDir}"
fi
done
'' + (lib.optionalString stdenv.isDarwin ''
# Work around a linker limit in Mac OS X Sierra (see generic-builder.nix):
local packageConfDir="$out/lib/${ghc.name}/package.conf.d";
local dynamicLinksDir="$out/lib/links"
mkdir -p $dynamicLinksDir
# Clean up the old links that may have been (transitively) included by
# symlinkJoin:
rm -f $dynamicLinksDir/*
for d in $(grep dynamic-library-dirs $packageConfDir/*|awk '{print $2}'); do
ln -s $d/*.dylib $dynamicLinksDir
done
for f in $packageConfDir/*.conf; do
# Initially, $f is a symlink to a read-only file in one of the inputs
# (as a result of this symlinkJoin derivation).
# Replace it with a copy whose dynamic-library-dirs points to
# $dynamicLinksDir
cp $f $f-tmp
rm $f
sed "s,dynamic-library-dirs: .*,dynamic-library-dirs: $dynamicLinksDir," $f-tmp > $f
rm $f-tmp
done
'') + ''
${lib.optionalString hasLibraries "$out/bin/${ghcCommand}-pkg recache"}
${# ghcjs will read the ghc_libdir file when resolving plugins.
lib.optionalString (isGhcjs && ghcLibdir != null) ''