summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorAnthony Cowley <acowley@gmail.com>2015-12-17 17:02:40 -0500
committerAnthony Cowley <acowley@gmail.com>2016-01-19 17:47:11 -0500
commitd96893647de5c519c458c1254f043f2d67d9b29c (patch)
treef44bc4c05735c8587fa1f450a061853a18b679e3 /pkgs/stdenv
parent322a69137754aecf8ce9860b55d7c2bedcc7d873 (diff)
downloadnixlib-d96893647de5c519c458c1254f043f2d67d9b29c.tar
nixlib-d96893647de5c519c458c1254f043f2d67d9b29c.tar.gz
nixlib-d96893647de5c519c458c1254f043f2d67d9b29c.tar.bz2
nixlib-d96893647de5c519c458c1254f043f2d67d9b29c.tar.lz
nixlib-d96893647de5c519c458c1254f043f2d67d9b29c.tar.xz
nixlib-d96893647de5c519c458c1254f043f2d67d9b29c.tar.zst
nixlib-d96893647de5c519c458c1254f043f2d67d9b29c.zip
cc-wrapper: fix on darwin
The ld-wrapper.sh script calls `readlink` in some circumstances. We need
to ensure that this is the `readlink` from the `coreutils` package so
that flag support is as expected.

This is accomplished by explicitly setting PATH at the top of each shell
script.

Without doing this, the following happens with a trivial `main.c`:

```
nix-env -f "<nixpkgs>" -iA pkgs.clang
$ clang main.c -L /nix/../nix/store/2ankvagznq062x1gifpxwkk7fp3xwy63-xnu-2422.115.4/Library -o a.out
readlink: illegal option -- f
usage: readlink [-n] [file ...]
```

The key element is the `..` in the path supplied to the linker via a
`-L` flag. With this patch, the above invocation works correctly on
darwin, whose native `/usr/bin/readlink` does not support the `-f` flag.

The explicit path also ensures that the `grep` called by `cc-wrapper.sh`
is the one from Nix.

Fixes #6447
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/darwin/default.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix
index c0c19a64c3c7..0af7071e2186 100644
--- a/pkgs/stdenv/darwin/default.nix
+++ b/pkgs/stdenv/darwin/default.nix
@@ -278,7 +278,7 @@ in rec {
       inherit stdenv shell;
       nativeTools = false;
       nativeLibc  = false;
-      inherit (pkgs) coreutils binutils;
+      inherit (pkgs) coreutils binutils gnugrep;
       inherit (pkgs.darwin) dyld;
       cc   = pkgs.llvmPackages.clang-unwrapped;
       libc = pkgs.darwin.Libsystem;