haskell.compiler.ghc865Binary: drop

This was used for bootstrapping GHC on powerpc64le, but it's unclear
whether that actually still works. It makes no sense to pretend to
support it, when it's most likely broken, but we can't even verify.

Also the bootstrap chain will be broken once we drop GHC 8.10.7, so we
might as well drop the whole thing.
This commit is contained in:
Wolfgang Walther
2025-09-05 13:29:48 +02:00
committed by sternenseemann
parent ceb749bf03
commit 4a5ab1eb69
6 changed files with 11 additions and 434 deletions

View File

@@ -24,6 +24,8 @@
- GCC 9, 10, 11, and 12 have been removed, as they have reached endoflife upstream and are no longer supported.
- GHC 8.6.5 and its package set have been removed. It was only used to bootstrap GHC for powerpc64le, but this was probably broken anyway.
- `base16-builder` node package has been removed due to lack of upstream maintenance.
- `python3Packages.bjoern` has been removed, as the upstream is unmaintained and it depends on a 14-year-old version of http-parser with numerous vulnerabilities.

View File

@@ -1,268 +0,0 @@
{
lib,
stdenv,
fetchurl,
perl,
gcc,
ncurses5,
ncurses6,
gmp,
glibc,
libiconv,
llvmPackages,
coreutils,
targetPackages,
}:
# Prebuilt only does native
assert stdenv.targetPlatform == stdenv.hostPlatform;
let
useLLVM =
!(stdenv.targetPlatform.isx86 || stdenv.targetPlatform.isPower || stdenv.targetPlatform.isSparc);
useNcurses6 =
stdenv.hostPlatform.system == "x86_64-linux"
|| (with stdenv.hostPlatform; isPower64 && isLittleEndian);
ourNcurses = if useNcurses6 then ncurses6 else ncurses5;
libPath = lib.makeLibraryPath (
[
ourNcurses
gmp
]
++ lib.optional (stdenv.hostPlatform.isDarwin) libiconv
);
libEnvVar = lib.optionalString stdenv.hostPlatform.isDarwin "DY" + "LD_LIBRARY_PATH";
glibcDynLinker =
assert stdenv.hostPlatform.isLinux;
if stdenv.hostPlatform.libc == "glibc" then
# Could be stdenv.cc.bintools.dynamicLinker, keeping as-is to avoid rebuild.
''"$(cat $NIX_CC/nix-support/dynamic-linker)"''
else
"${lib.getLib glibc}/lib/ld-linux*";
downloadsUrl = "https://downloads.haskell.org/ghc";
runtimeDeps = [
targetPackages.stdenv.cc
targetPackages.stdenv.cc.bintools
coreutils # for cat
]
++
lib.optionals
(
assert useLLVM -> !(llvmPackages == null);
useLLVM
)
[
(lib.getBin llvmPackages.llvm)
]
# On darwin, we need unwrapped bintools as well (for otool)
++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [
targetPackages.stdenv.cc.bintools.bintools
];
in
stdenv.mkDerivation rec {
version = "8.6.5";
pname = "ghc-binary";
# https://downloads.haskell.org/~ghc/8.6.5/
src = fetchurl (
{
i686-linux = {
# Don't use the Fedora27 build (as below) because there isn't one!
url = "${downloadsUrl}/${version}/ghc-${version}-i386-deb9-linux.tar.xz";
sha256 = "1p2h29qghql19ajk755xa0yxkn85slbds8m9n5196ris743vkp8w";
};
x86_64-linux = {
# This is the Fedora build because it links against ncurses6 where the
# deb9 one links against ncurses5, see here
# https://github.com/NixOS/nixpkgs/issues/85924 for a discussion
url = "${downloadsUrl}/${version}/ghc-${version}-x86_64-fedora27-linux.tar.xz";
sha256 = "18dlqm5d028fqh6ghzn7pgjspr5smw030jjzl3kq6q1kmwzbay6g";
};
x86_64-darwin = {
url = "${downloadsUrl}/${version}/ghc-${version}-x86_64-apple-darwin.tar.xz";
sha256 = "0s9188vhhgf23q3rjarwhbr524z6h2qga5xaaa2pma03sfqvvhfz";
};
powerpc64le-linux = {
url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-powerpc64le-fedora29-linux.tar.xz";
sha256 = "sha256-tWSsJdPVrCiqDyIKzpBt5DaXb3b6j951tCya584kWs4=";
};
}
.${stdenv.hostPlatform.system} or (throw "cannot bootstrap GHC on this platform")
);
nativeBuildInputs = [ perl ];
# Cannot patchelf beforehand due to relative RPATHs that anticipate
# the final install location/
${libEnvVar} = libPath;
postUnpack =
# GHC has dtrace probes, which causes ld to try to open /usr/lib/libdtrace.dylib
# during linking
lib.optionalString stdenv.hostPlatform.isDarwin ''
export NIX_LDFLAGS+=" -no_dtrace_dof"
# not enough room in the object files for the full path to libiconv :(
for exe in $(find . -type f -executable); do
isScript $exe && continue
ln -fs ${libiconv}/lib/libiconv.dylib $(dirname $exe)/libiconv.dylib
install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $exe
done
''
+
# Some scripts used during the build need to have their shebangs patched
''
patchShebangs ghc-${version}/utils/
patchShebangs ghc-${version}/configure
test -d ghc-${version}/inplace/bin && \
patchShebangs ghc-${version}/inplace/bin
''
+
# We have to patch the GMP paths for the integer-gmp package.
''
find . -name integer-gmp.buildinfo \
-exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${gmp.out}/lib@" {} \;
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
find . -name base.buildinfo \
-exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${libiconv}/lib@" {} \;
''
+
# Rename needed libraries and binaries, fix interpreter
lib.optionalString stdenv.hostPlatform.isLinux ''
find . -type f -perm -0100 \
-exec patchelf \
--replace-needed libncurses${lib.optionalString stdenv.hostPlatform.is64bit "w"}.so.5 libncurses.so \
${
# This isn't required for x86_64-linux where we use ncurses6
lib.optionalString (!useNcurses6) "--replace-needed libtinfo.so libtinfo.so.5"
} \
--interpreter ${glibcDynLinker} {} \;
sed -i "s|/usr/bin/perl|perl\x00 |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
sed -i "s|/usr/bin/gcc|gcc\x00 |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
''
+
# We're kludging a glibc bindist into working with non-glibc...
# Here we patch up the use of `__strdup` (part of glibc binary ABI)
# to instead use `strdup` since musl doesn't provide __strdup
# (`__strdup` is defined to be an alias of `strdup` anyway[1]).
# [1] http://refspecs.linuxbase.org/LSB_4.0.0/LSB-Core-generic/LSB-Core-generic/baselib---strdup-1.html
# Use objcopy magic to make the change:
lib.optionalString stdenv.hostPlatform.isMusl ''
find ./ghc-${version}/rts -name "libHSrts*.a" -exec ''${OBJCOPY:-objcopy} --redefine-sym __strdup=strdup {} \;
'';
configurePlatforms = [ ];
configureFlags = [
"--with-gmp-includes=${lib.getDev gmp}/include"
# Note `--with-gmp-libraries` does nothing for GHC bindists:
# https://gitlab.haskell.org/ghc/ghc/-/merge_requests/6124
]
++ lib.optional stdenv.hostPlatform.isDarwin "--with-gcc=${./gcc-clang-wrapper.sh}"
++ lib.optional stdenv.hostPlatform.isMusl "--disable-ld-override";
# No building is necessary, but calling make without flags ironically
# calls install-strip ...
dontBuild = true;
# GHC tries to remove xattrs when installing to work around Gatekeeper
# (see https://gitlab.haskell.org/ghc/ghc/-/issues/17418). This step normally
# succeeds in nixpkgs because xattrs are not allowed in the store, but it
# can fail when a file has the `com.apple.provenance` xattr, and it cant be
# modified (such as target of the symlink to `libiconv.dylib`).
# The `com.apple.provenance` xattr is a new feature of macOS as of macOS 13.
# See: https://eclecticlight.co/2023/03/13/ventura-has-changed-app-quarantine-with-a-new-xattr/
makeFlags = lib.optionals stdenv.buildPlatform.isDarwin [ "XATTR=/does-not-exist" ];
# Patch scripts to include runtime dependencies in $PATH.
postInstall = ''
for i in "$out/bin/"*; do
test ! -h "$i" || continue
isScript "$i" || continue
sed -i -e '2i export PATH="${lib.makeBinPath runtimeDeps}:$PATH"' "$i"
done
'';
# On Linux, use patchelf to modify the executables so that they can
# find editline/gmp.
postFixup =
lib.optionalString stdenv.hostPlatform.isLinux ''
for p in $(find "$out" -type f -executable); do
if isELF "$p"; then
echo "Patchelfing $p"
patchelf --set-rpath "${libPath}:$(patchelf --print-rpath $p)" $p
fi
done
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
# not enough room in the object files for the full path to libiconv :(
for exe in $(find "$out" -type f -executable); do
isScript $exe && continue
ln -fs ${libiconv}/lib/libiconv.dylib $(dirname $exe)/libiconv.dylib
install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $exe
done
for file in $(find "$out" -name setup-config); do
substituteInPlace $file --replace /usr/bin/ranlib "$(type -P ranlib)"
done
'';
# GHC cannot currently produce outputs that are ready for `-pie` linking.
# Thus, disable `pie` hardening, otherwise `recompile with -fPIE` errors appear.
# See:
# * https://github.com/NixOS/nixpkgs/issues/129247
# * https://gitlab.haskell.org/ghc/ghc/-/issues/19580
hardeningDisable = [ "pie" ];
doInstallCheck = true;
installCheckPhase = ''
# Sanity check, can ghc create executables?
cd $TMP
mkdir test-ghc; cd test-ghc
cat > main.hs << EOF
{-# LANGUAGE TemplateHaskell #-}
module Main where
main = putStrLn \$([|"yes"|])
EOF
env -i $out/bin/ghc --make main.hs || exit 1
echo compilation ok
[ $(./main) == "yes" ]
'';
passthru = {
targetPrefix = "";
enableShared = true;
inherit llvmPackages;
# Our Cabal compiler name
haskellCompilerName = "ghc-${version}";
};
meta = rec {
license = lib.licenses.bsd3;
platforms = [
"x86_64-linux"
"i686-linux"
"x86_64-darwin"
"powerpc64le-linux"
];
# build segfaults, use ghc8107Binary which has proper musl support instead
broken = stdenv.hostPlatform.isMusl;
maintainers = with lib.maintainers; [
guibou
];
teams = [ lib.teams.haskell ];
};
}

View File

@@ -1,97 +0,0 @@
{ pkgs, haskellLib }:
with haskellLib;
let
inherit (pkgs.stdenv.hostPlatform) isDarwin;
in
self: super: {
# Should be llvmPackages_6 which has been removed from nixpkgs,
# create attribute set to prevent eval errors.
llvmPackages = {
llvm = null;
clang = null;
};
# Disable GHC 8.6.x core libraries.
array = null;
base = null;
binary = null;
bytestring = null;
Cabal = null;
containers = null;
deepseq = null;
directory = null;
filepath = null;
ghc-boot = null;
ghc-boot-th = null;
ghc-compact = null;
ghc-heap = null;
ghc-prim = null;
ghci = null;
haskeline = null;
hpc = null;
integer-gmp = null;
libiserv = null;
mtl = null;
parsec = null;
pretty = null;
process = null;
rts = null;
stm = null;
template-haskell = null;
# GHC only builds terminfo if it is a native compiler
terminfo =
if pkgs.stdenv.hostPlatform == pkgs.stdenv.buildPlatform then
null
else
doDistribute self.terminfo_0_4_1_7;
text = null;
time = null;
transformers = null;
unix = null;
# GHC only bundles the xhtml library if haddock is enabled, check if this is
# still the case when updating: https://gitlab.haskell.org/ghc/ghc/-/blob/0198841877f6f04269d6050892b98b5c3807ce4c/ghc.mk#L463
xhtml = if self.ghc.hasHaddock or true then null else doDistribute self.xhtml_3000_4_0_0;
# Need the Cabal-syntax-3.6.0.0 fake package for Cabal < 3.8 to allow callPackage and the constraint solver to work
Cabal-syntax = self.Cabal-syntax_3_6_0_0;
# These core package only exist for GHC >= 9.4. The best we can do is feign
# their existence to callPackages, but their is no shim for lower GHC versions.
system-cxx-std-lib = null;
# Becomes a core package in GHC >= 9.8
semaphore-compat = doDistribute self.semaphore-compat_1_0_0;
# Needs Cabal 3.0.x.
jailbreak-cabal = super.jailbreak-cabal.overrideScope (cself: _: { Cabal = cself.Cabal_3_2_1_0; });
# Test suite does not compile.
data-clist = doJailbreak super.data-clist; # won't cope with QuickCheck 2.12.x
dates = doJailbreak super.dates; # base >=4.9 && <4.12
HaTeX = doJailbreak super.HaTeX; # containers >=0.4 && <0.6 is too tight; https://github.com/Daniel-Diaz/HaTeX/issues/126
hpc-coveralls = doJailbreak super.hpc-coveralls; # https://github.com/guillaume-nargeot/hpc-coveralls/issues/82
http-api-data = doJailbreak super.http-api-data;
wl-pprint-extras = doJailbreak super.wl-pprint-extras; # containers >=0.4 && <0.6 is too tight; https://github.com/ekmett/wl-pprint-extras/issues/17
rebase = doJailbreak super.rebase; # time ==1.9.* is too low
# cabal2nix needs the latest version of Cabal, and the one
# hackage-db uses must match, so take the latest
cabal2nix = super.cabal2nix.overrideScope (self: super: { Cabal = self.Cabal_3_2_1_0; });
# cabal2spec needs a recent version of Cabal
cabal2spec = super.cabal2spec.overrideScope (self: super: { Cabal = self.Cabal_3_2_1_0; });
# ghc versions prior to 8.8.x needs additional dependency to compile successfully.
ghc-lib-parser-ex = addBuildDepend self.ghc-lib-parser super.ghc-lib-parser-ex;
# Needs base-orphans for GHC < 9.8 / base < 4.19
some = addBuildDepend self.base-orphans super.some;
# This became a core library in ghc 8.10., so we dont have an "exception" attribute anymore.
exceptions = self.exceptions_0_10_10;
mime-string = disableOptimization super.mime-string;
}

View File

@@ -957,7 +957,7 @@ lib.fix (
# # and with python:
#
# > nix-shell -E 'with (import <nixpkgs> {}); \
# > haskell.packages.ghc865.hello.envFunc { buildInputs = [ python ]; }'
# > haskellPackages.hello.envFunc { buildInputs = [ python ]; }'
envFunc =
{
withHoogle ? false,

View File

@@ -20,7 +20,6 @@ let
"integer-simple"
"native-bignum"
# Binary GHCs
"ghc865Binary"
"ghc8107Binary"
"ghc902Binary"
"ghc924Binary"
@@ -79,11 +78,6 @@ in
bb = pkgsBuildBuild.haskell;
in
{
ghc865Binary = callPackage ../development/compilers/ghc/8.6.5-binary.nix {
# Should be llvmPackages_6 which has been removed from nixpkgs
llvmPackages = null;
};
ghc8107Binary = callPackage ../development/compilers/ghc/8.10.7-binary.nix {
llvmPackages = pkgs.llvmPackages_12;
};
@@ -105,13 +99,7 @@ in
};
ghc8107 = callPackage ../development/compilers/ghc/8.10.7.nix {
bootPkgs =
# the oldest ghc with aarch64-darwin support is 8.10.5
if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
# to my (@a-m-joseph) knowledge there are no newer official binaries for this platform
bb.packages.ghc865Binary
else
bb.packages.ghc8107Binary;
bootPkgs = bb.packages.ghc8107Binary;
inherit (buildPackages.python311Packages) sphinx; # a distutils issue with 3.12
python3 = buildPackages.python311; # so that we don't have two of them
# Need to use apple's patched xattr until
@@ -123,12 +111,7 @@ in
};
ghc810 = compiler.ghc8107;
ghc902 = callPackage ../development/compilers/ghc/9.0.2.nix {
bootPkgs =
# the oldest ghc with aarch64-darwin support is 8.10.5
if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
bb.packages.ghc810
else
bb.packages.ghc8107Binary;
bootPkgs = bb.packages.ghc8107Binary;
inherit (buildPackages.python311Packages) sphinx; # a distutils issue with 3.12
python3 = buildPackages.python311; # so that we don't have two of them
inherit (buildPackages.darwin) autoSignDarwinBinariesHook xattr;
@@ -139,13 +122,7 @@ in
ghc928 = callPackage ../development/compilers/ghc/9.2.8.nix {
bootPkgs =
# GHC >= 9.0 removed the armv7l bindist
if stdenv.buildPlatform.isAarch32 then
bb.packages.ghc8107Binary
# No suitable bindists for powerpc64le
else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
bb.packages.ghc902
else
bb.packages.ghc902Binary;
if stdenv.buildPlatform.isAarch32 then bb.packages.ghc8107Binary else bb.packages.ghc902Binary;
inherit (buildPackages.python311Packages) sphinx; # a distutils issue with 3.12
python3 = buildPackages.python311; # so that we don't have two of them
# Need to use apple's patched xattr until
@@ -160,11 +137,6 @@ in
bootPkgs =
# Building with 9.2 is broken due to
# https://gitlab.haskell.org/ghc/ghc/-/issues/21914
# No suitable bindists for powerpc64le
if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
bb.packages.ghc902
else
bb.packages.ghc902Binary;
inherit (buildPackages.python3Packages) sphinx;
# Need to use apple's patched xattr until
@@ -179,12 +151,7 @@ in
ghc963 = callPackage ../development/compilers/ghc/9.6.3.nix {
bootPkgs =
# For GHC 9.2 no armv7l bindists are available.
if stdenv.buildPlatform.isAarch32 then
bb.packages.ghc928
else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
bb.packages.ghc928
else
bb.packages.ghc924Binary;
if stdenv.buildPlatform.isAarch32 then bb.packages.ghc928 else bb.packages.ghc924Binary;
inherit (buildPackages.python3Packages) sphinx;
# Need to use apple's patched xattr until
# https://github.com/xattr/xattr/issues/44 and
@@ -197,12 +164,7 @@ in
ghc967 = callPackage ../development/compilers/ghc/9.6.7.nix {
bootPkgs =
# For GHC 9.2 no armv7l bindists are available.
if stdenv.buildPlatform.isAarch32 then
bb.packages.ghc928
else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
bb.packages.ghc928
else
bb.packages.ghc924Binary;
if stdenv.buildPlatform.isAarch32 then bb.packages.ghc928 else bb.packages.ghc924Binary;
inherit (buildPackages.python3Packages) sphinx;
# Need to use apple's patched xattr until
# https://github.com/xattr/xattr/issues/44 and
@@ -220,8 +182,6 @@ in
else if stdenv.buildPlatform.isAarch32 then
# For GHC 9.6 no armv7l bindists are available.
bb.packages.ghc963
else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
bb.packages.ghc963
else
bb.packages.ghc963Binary;
inherit (buildPackages.python3Packages) sphinx;
@@ -239,8 +199,6 @@ in
# For GHC 9.6 no armv7l bindists are available.
if stdenv.buildPlatform.isAarch32 then
bb.packages.ghc963
else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
bb.packages.ghc963
else if stdenv.buildPlatform.isDarwin then
# it seems like the GHC 9.6.* bindists are built with a different
# toolchain than we are using (which I'm guessing from the fact
@@ -264,8 +222,6 @@ in
# For GHC 9.6 no armv7l bindists are available.
if stdenv.buildPlatform.isAarch32 then
bb.packages.ghc963
else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
bb.packages.ghc963
else if stdenv.buildPlatform.isDarwin then
# it seems like the GHC 9.6.* bindists are built with a different
# toolchain than we are using (which I'm guessing from the fact
@@ -315,12 +271,7 @@ in
ghcHEAD = callPackage ../development/compilers/ghc/head.nix {
bootPkgs =
# No armv7l bindists are available.
if stdenv.buildPlatform.isAarch32 then
bb.packages.ghc984
else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
bb.packages.ghc984
else
bb.packages.ghc984Binary;
if stdenv.buildPlatform.isAarch32 then bb.packages.ghc984 else bb.packages.ghc984Binary;
inherit (buildPackages.python3Packages) sphinx;
# Need to use apple's patched xattr until
# https://github.com/xattr/xattr/issues/44 and
@@ -374,13 +325,6 @@ in
bh = buildPackages.haskell;
in
{
ghc865Binary = callPackage ../development/haskell-modules {
buildHaskellPackages = bh.packages.ghc865Binary;
ghc = bh.compiler.ghc865Binary;
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.6.x.nix { };
packageSetConfig = bootstrapPackageSet;
};
ghc8107Binary = callPackage ../development/haskell-modules {
buildHaskellPackages = bh.packages.ghc8107Binary;
ghc = bh.compiler.ghc8107Binary;

View File

@@ -384,11 +384,7 @@ let
"aarch64-darwin"
]
{
haskell.compiler = lib.recursiveUpdate (packagePlatforms pkgs.pkgsMusl.haskell.compiler) {
# remove musl ghc865Binary since it is known to be broken and
# causes an evaluation error on darwin.
ghc865Binary = { };
};
haskell.compiler = packagePlatforms pkgs.pkgsMusl.haskell.compiler;
# Get some cache going for MUSL-enabled GHC.
haskellPackages = {