summary refs log tree commit diff
path: root/pkgs/build-support/cc-wrapper
diff options
context:
space:
mode:
authorSergei Trofimovich <slyich@gmail.com>2023-01-28 16:29:08 +0000
committerSergei Trofimovich <slyich@gmail.com>2023-01-29 07:49:37 +0000
commit6b832b53320bbecd556804dff270ad50a3ee122d (patch)
tree95f69afcf95be8ae7a24f112901fa738c0a84610 /pkgs/build-support/cc-wrapper
parent62484a2a2315a321193758e62c15f0b3fc579058 (diff)
downloadnixpkgs-6b832b53320bbecd556804dff270ad50a3ee122d.tar
nixpkgs-6b832b53320bbecd556804dff270ad50a3ee122d.tar.gz
nixpkgs-6b832b53320bbecd556804dff270ad50a3ee122d.tar.bz2
nixpkgs-6b832b53320bbecd556804dff270ad50a3ee122d.tar.lz
nixpkgs-6b832b53320bbecd556804dff270ad50a3ee122d.tar.xz
nixpkgs-6b832b53320bbecd556804dff270ad50a3ee122d.tar.zst
nixpkgs-6b832b53320bbecd556804dff270ad50a3ee122d.zip
build-support/cc-wrapper: revert "pass in non-existent --sysroot= to untangle from libc"
This reverts commit 8c80bd08b7e39229947d55104d1871f5066437d9
("build-support/cc-wrapper: pass in non-existent --sysroot= to untangle
from libc").

This change was good in spirit: we caught a few genuine problems with
`scons` based packages (`godot`, `fluxus`) and unexpected `-idirafter`
includes in various boot loadres (`ipxe`, wimboot`):

    https://github.com/NixOS/nixpkgs/pull/210004#issuecomment-1407162693

Unfortunately `--sysroot=` also has a negative impact on libary search
order for DT_NEEDED libraries and RUNPATHs of linked libraries. This
unexpectedly broke `dmd`, `d-seams`, `llvmPackages_rocm.compiler-rt`).

An interesting case of unexpected breakage is `usbmuxd2` where the bug
exposed incomplete library move on `libstdc++fs` in `gcc`.

The library breakage is very non-intuitive (on top of already unusual
layout of `cc-wrapper` driver). Let's revert this change for now.

Once it lands we can undo `--sysroot=/` workarounds merged for
`staging-next`.
Diffstat (limited to 'pkgs/build-support/cc-wrapper')
-rw-r--r--pkgs/build-support/cc-wrapper/default.nix7
1 files changed, 0 insertions, 7 deletions
diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix
index 33df804d5ef..2f3b2d8e378 100644
--- a/pkgs/build-support/cc-wrapper/default.nix
+++ b/pkgs/build-support/cc-wrapper/default.nix
@@ -343,18 +343,11 @@ stdenv.mkDerivation {
     # compile, because it uses "#include_next <limits.h>" to find the
     # limits.h file in ../includes-fixed. To remedy the problem,
     # another -idirafter is necessary to add that directory again.
-    #
-    # We use --sysroot=/nix/store/does/not/exist to drop embedded default
-    # path to glibc headers gcc was built against. Without it -idirafter
-    # only appends to the list and outdated glibc headers end up being
-    # used. 'cc-cflags-before' is used to allow user's --sysroot= option
-    # to override our default.
     + optionalString (libc != null) (''
       touch "$out/nix-support/libc-cflags"
       touch "$out/nix-support/libc-ldflags"
       echo "-B${libc_lib}${libc.libdir or "/lib/"}" >> $out/nix-support/libc-crt1-cflags
     '' + optionalString (!(cc.langD or false)) ''
-      echo "--sysroot=/nix/store/does/not/exist" >> $out/nix-support/cc-cflags-before
       echo "-idirafter ${libc_dev}${libc.incdir or "/include"}" >> $out/nix-support/libc-cflags
     '' + optionalString (isGNU && (!(cc.langD or false))) ''
       for dir in "${cc}"/lib/gcc/*/*/include-fixed; do