Skip to content

Commit

Permalink
dmd: set --sysroot=/ to avoid cc-wrapper value
Browse files Browse the repository at this point in the history
After NixOS/nixpkgs#210004 `dmd` started failing
build as:

    ld: warning: libm.so.6, needed by ./generated/linux/release/64/lib.so, not found (try using -rpath or -rpath-link)
    ld: /build/druntime/generated/linux/release/64/libdruntime.so: undefined reference to `log10@GLIBC_2.2.5'

This happens because --sysroot=/nix/store/does/not/exist removes not
just include headers by prefixing wrong path, but also removes RUNPATH
dependencies of linked libraries. It's an unintended effect.

Restore the build by reversing the effect with --sysroot=/.
  • Loading branch information
trofi authored and PetarKirov committed Apr 20, 2023
1 parent b1aa8e7 commit 3d9b777
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkgs/dmd/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ stdenv.mkDerivation rec {
git
];

# Workaround cc-wrapper's --sysroot= value for `staging-next`: it
# breaks library lookup via RUNPATH:
# ld: warning: libm.so.6, needed by ./generated/linux/release/64/lib.so, not found (try using -rpath or -rpath-link)
# ld: /build/druntime/generated/linux/release/64/libdruntime.so: undefined reference to `log10@GLIBC_2.2.5'
# TODO(trofi): remove the workaround once cc-wrapper is fixed.
NIX_CFLAGS_COMPILE = [ "--sysroot=/" ];

buildInputs = [
curl
tzdata
Expand Down

0 comments on commit 3d9b777

Please sign in to comment.