On Tue, Aug 30, 2022 at 6:58 AM Kevin King <4kevinking@gmail.com> wrote:
>
> The error I get is
>
> linking with `/private/var/tmp/_bazel_kevin/c782d9784982eee1866a2e1ae5f6f353/external/zig_sdk/tools/c++` failed: exit status: 127
> [...]
> = note: env: sh: No such file or directory
>
> This appears to mean /usr/bin/env is executed correctly, but env itself can't find sh. Linking succeeds when I change the zig wrapper to use /bin/sh directly, leading me to believe rust does not pass PATH down to the linker.
I asked in #zig:libera.chat, and Andrew pointed out that `/bin/sh` and
`/usr/bin/env` are the only two files in `/bin` and `/usr/bin`
respectively. So `#!/bin/sh` will work both NixOS and in your case,
since it's an absolute path.
I will make the change in bazel-zig-cc later today.
Motiejus