Repository navigation
Conversation
|
By analyzing the blame information on this pull request, we identified @edolstra, @gridaphobe and @copumpkin to be potential reviewers |
|
Ah, so the use case here is for interactive invocations of |
|
Yes, that is correct! |
|
Given that it's a mass rebuild, this should probably go into |
|
Ah, okay. Can you move it or shall I? |
|
I don't think GitHub allows one to repoint a PR. Someone could just merge the patch manually to |
|
Yes, what you said sounded reasonable. I figured that since nothing has happened for several months, fixing this instance now is expedient, and perhaps the lack of broader outcry indicates the problem doesn't arise as frequently as it might. It's a pretty substantial nuisance, as it makes development tools installed via nix much less useful than they otherwise ought to be. |
|
There were multiple impure references in cc-wrapper scripts. I wonder if it's better to hardcode the paths directly 093f58b or just specify |
|
Setting
👍 from me on that approach |
|
That sounds like the right approach. |
|
This is actually a bit trickier than I anticipated. First, the straightforward idea of just using, e.g., Perhaps one of the more experienced darwin folks (e.g. @copumpkin @shlevy @gridaphobe @pikajude ) might suggest a fix. I can work at it, but it's a slog. |
|
The problem is that the final version of cc-wrapper is referencing the bootstrap coreutils, not the final version. One potential fix would be to rewrap the final clang after building the final coreutils. But is there any reason we need to use identical wrappers for builds and for users? We already have |
|
I'm not familiar enough with the bring-up of the whole environment to make architectural changes. I had hoped that the |
|
The whole point is that it wouldn't be necessary to refer to it when building stdenv, right? Since cc-wrapper works fine in nix builds, it only fails for the user? |
|
Oh, I'll have to re-run the test I guess. The build error made me think my attempted rebuild of things broke while building stdenv. These builds take a long time to get back to a development environment I can work with, so I usually kick off a downstream build and check back in a day to read the error messages. I'll try again some other time and only build one thing at a time as that error message is apparently pretty confusing. |
|
You'll have to revert your change. The build error is because the final stdenv contains a reference to the bootstrap tools. If you have a separate ccInteractive, it will refer to the newly-built coreutils, not the bootstrap coreutils. |
|
The linked issue for this PR was the problem being exposed in GHC through its use of the linker. So, if I'm understanding the suggestion, it would be to leave |
|
Ah, yeah. I'm not sure what the best solution is there really. Hmm, I wonder if the better solution is to include coreutils in nix-env environments by default? |
|
Part of my question that I perhaps didn't make suitably clear is why I'm running into this problem with this change: I don't understand what this change does that introduces the illegal It seems like the right fix should be adjacent to the current state of the PR given that my original attempt of just using an explicit |
|
Hmm, are you sure that your original attempt worked? Based on a modern nixpkgs? The |
|
Yes, I'm sure. I haven't come across EDIT: I realize I asked for input from more people somewhat further along this road than is ideal. The first attempt at fixing this that worked for me was simply replacing the naked call to The more ambitious explicit setting of all PATH variables has caused this reference from |
|
Sorry, it's |
|
Oh, right, I should have recognized that. I'm actually not sure which specific reference in |
|
You can do |
|
Well, that's quite a large tree, but the |
|
I misunderstood the suggestion to look at |
|
You can also get something far clearer with |
|
@acowley You looked at the graph f or the |
|
I looked at the I can read the ETA: Doing some manual spelunking of that nature, |
|
Ugh, right, because the build failed. Can you check the dependency tree of the cc-wrapper that's closest to stdenv? |
|
@edolstra How difficult would it be to have nix store the dependency info of a build that failed due to disallowed dependencies (either because of allowedReferences or circular reference in multiple outputs) somewhere for investigations like this? |
|
I don't quite follow what you mean by "closest". I looked at the |
The output paths of any failed build remain in the /nix/store (at least for me). You can |
|
Small update: I tried taking out the PR lines that clear I dug into the m4 build failure a bit since it's a smaller thing to look at, and it's kind of interesting. The build failures are due to various checks in m4's build system to accommodate Apple's SDK. Since we still pull a version of LibSystem in, we run into trouble with things like redefinitions of (ETA: If you're curious, one of the macros that changes when built in a nix-shell vs OS X shell is Alternatively, if I take the unpacked nixpkgs m4 package, and So either explicitly setting the To summarize the current situation, the only working version of this PR -- "working" in that the parts of nixpkgs I use all build, and compilers (clang and ghc) can be used outside of a nix shell -- is the one where only the call to |
6ce4fd1 to
07f12d1
Compare
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 NixOS#6447
|
I finally got this working. The last holdup was that I've only built this on darwin so far (and that was before the last rebase, so I'll build again tonight), so other stdenvs likely need adjustment to satisfy the explicit |
|
Ah, right, my assumption in #11798 (comment) was wrong – apparently it is necessary to do some kind of save-restore dance. While in these cases it's not too bad due to only having a single external I assume you have tested this well on darwin? Linux doesn't evaluate ATM, but I'll have a look into it. How bash's environment seems to workIf one makes a change to a variable that is exported, that change is propagated to sub-processes. Even if one marks it |
|
Yes, I tried to avoid the dance, but couldn't make that work, either. It's been a long, boring voyage :) I did a new build last night, so I'll work it over today to make sure everything is ship shape on Darwin. It seems fine from poking around clang and GHC, but I'll update if I find a problem. |
|
Everything looks good on Darwin. Can anyone help me navigate getting Linux and NixOS (and WIndows?) validation? I can wrangle VMs, but if there's existing infrastructure I'd rather use that. ETA: Specifically, we need to check if |
|
I spun up a NixOS VM on EC2, set nixpkgs to a checkout of this branch, and did a |
|
The last commit seems to get Linux up and running. The trick there is that, as far as I can see, Linux was working because the grep executable came along with the bootstrap tools. Explicitly requiring Any help getting other stdenvs in order would be much appreciated! |
|
There are rather a lot of arguably problematic shell scripts that make use of utilities. Perhaps this kind of explicit dependency tracking isn't realistic for Non-Linux platforms could alternately be supported by patching on an as-needed basis. |
|
Staged after some minor fixups: 8f48a97 and 98c7e70. |
The ld-wrapper.sh script calls
readlinkin some circumstances. We needto ensure that this is the
readlinkfrom thecoreutilspackage sothat flag support is as expected.
Without doing this, the following happens with a trivial
main.c:The key element is the
..in the path supplied to the linker via a-Lflag. With this patch, the above invocation works correctly ondarwin, whose native
/usr/bin/readlinkdoes not support the-fflag.Fixes #6447