Closed nh2 closed 1 year ago
Trying
nix-build --no-out-link survey/default.nix -A working.hello
fails with linker errors regarding libelf.
Investigating the linker invocation (revealed by passing -v
to ghc
), we see ... -lelf -ldw ...
.
That's the wrong way around.
Inverting them, we see linker errors regaring symbols from ZSTD and other compression libraries that libdw
uses.
Adding:
-L/nix/store/lh5mwy1f0ncakvahryrs3qfxd9pgp81c-zstd-static-x86_64-unknown-linux-musl-1.5.5/lib -lzstd
-L/nix/store/xyc3qbpkamyjif6aryrdkfwybsax8fqr-zlib-static-x86_64-unknown-linux-musl-1.2.13/lib -lz
-L/nix/store/vf10zcfikzhxa8lzbr3wy7pfvzyzhr3r-bzip2-static-x86_64-unknown-linux-musl-1.0.8/lib -lbz2
-L/nix/store/adas6a61mndhcb3sflxgrnpykhdq7acn-xz-static-x86_64-unknown-linux-musl-5.4.3/lib -llzma
Then we get
ld: /nix/store/13gccvgy3br4jdacyc7ir7h37231d7ib-elfutils-0.189/lib/libdw.a(libdw_alloc.o): in function `__libdw_oom':
(.text+0x2c0): undefined reference to `error'
Unclear what error
function it is referring to.
broken = stdenv.hostPlatform.isStatic;
with comment:
https://lists.fedorahosted.org/pipermail/elfutils-devel/2014-November/004223.html
This says that libdwarf
requires dlopen()
which musl does not support
So instead we just give up on this and set enableDwarf = false
for our musl GHC build.Debugging why it still has the elf-related linker error after disabling DWARF:
nix-build --no-out-link --expr '(import ./survey/default.nix {}).working.hello.overrideAttrs (old: { configureFlags = (old.configureFlags or []) ++ ["--ghc-options=-v"]; })'
Debugging why it still has the elf-related linker error after disabling DWARF:
We overrode the GHC incorrectly, overriding only ghc
but not buildHaskellPackages
.
@jonathanlking, @chpatrick and me added support for useArchiveFilesForTemplateHaskell
and basic support for ghc962
.
ghc962
can build hello
:
nix-build --expr '(import ./survey/default.nix { compiler = "ghc962"; useArchiveFilesForTemplateHaskell = true; }).working.hello'
but not much more because the Stackage in nixpkgs is targeting GHC 9.2. But that's fine because Bazel users likely don't need Haskell packages building in nixpkgs, as they build those themselves.
@jonathanlking @aherrmann
I pushed some new fixes.
Now only 9 packages fail for workingStackageExecutables
.
I have fixed a few more of the workingStackageExecutables
set, and made some more nixpkgs PRs (see abvoe).
368 Stackage executables build statically:
% nix-build --no-link survey/default.nix -A workingStackageExecutables | wc -l
368
The 28 that do not build are:
Agda
Allure
csg
cuda
debug
diagrams-builder
diagrams-cairo
gloss-examples
gtk-sni-tray
gtk3
H
hackage-cli
hamilton
hquantlib
ihaskell
LambdaHack
language-puppet
learn-physics
LPFP
magico
monomer
nanovg
odbc
pango
qchas
rhine-gloss
soxlib
termonad
Compare this to previous numbers.
Merging.
Work on ZuriHac 2023 with @jonathanlking: