Skip to content

Commit

Permalink
zlib: link with --undefined-version on lld
Browse files Browse the repository at this point in the history
  • Loading branch information
rhelmot committed May 1, 2024
1 parent 8e098ac commit 06cbdb9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pkgs/development/libraries/zlib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,16 @@ stdenv.mkDerivation (finalAttrs: {
ln -s zlib1.dll $out/bin/libz.dll
'';

# As zlib takes part in the stdenv building, we don't want references
# to the bootstrap-tools libgcc (as uses to happen on arm/mips)
env.NIX_CFLAGS_COMPILE = lib.optionalString (!stdenv.hostPlatform.isDarwin) "-static-libgcc";
env = lib.optionalAttrs (!stdenv.hostPlatform.isDarwin) {
# As zlib takes part in the stdenv building, we don't want references
# to the bootstrap-tools libgcc (as uses to happen on arm/mips)
NIX_CFLAGS_COMPILE = "-static-libgcc";
} // lib.optionalAttrs (stdenv.hostPlatform.linker == "lld") {
# lld 16 enables --no-undefined-version by defualt
# This makes configure think it can't build dynamic libraries
# this may be removed when a version is packaged with https://github.com/madler/zlib/issues/960 fixed
NIX_LDFLAGS = "--undefined-version";
};

# We don't strip on static cross-compilation because of reports that native
# stripping corrupted the target library; see commit 12e960f5 for the report.
Expand Down

0 comments on commit 06cbdb9

Please sign in to comment.