New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bazel: fix darwin #42609
bazel: fix darwin #42609
Conversation
Would be nice to figure out why this isn't passing on CI so we could get it checked. |
@GrahamcOfBorg build bazel |
No attempt on aarch64-linux (full log) The following builds were skipped because they don't evaluate on aarch64-linux: bazel Partial log (click to expand)
|
Failure on x86_64-darwin (full log) Attempted: bazel Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: bazel Partial log (click to expand)
|
Looks pretty much like the same error as without this PR: https://hydra.nixos.org/build/76471773 |
Yes, as I mentioned in #40525 (comment) it's because Xcode isn't installed on the hydra machines. The error this PR fixes appears much later. |
I know little about Mac infrastructure, but if this package needs Xcode to build, why isn't Xcode listed as a dependency? |
I never realised because it works on my machine, I just checked and it's because the path to xcrun is hardcoded here: which isn't too bad since on macOS that should be there even if you don't have Xcode installed, though it might prompt you to install the Command Line Developer Tools for Xcode package. Note that even the so using it is unnecessary to make this work on macOS, and it still won't fix the build on hydra. |
If these Command Line Developer Tools are required to build @matthewbauer how should we handle this? |
Oh that's not good. You're not allowed to use Command Line Tools in Nixpkgs due to licensing issues. We unfortunately do not have a good sandbox available to enforce this. (/cc @copumpkin @LnL7) Can someone mark this as broken until we can figure out a pure solution? Bazel should let us build without an Xcode SDK, which would be very much preferred. If not possible, we should try passing in |
Yeah, there's basically nothing in the official command-line tools that we don't provide in nixpkgs, so I'd be surprised if they were formally necessary for this. Of course, Bazel is notorious for hardcoding paths to shit 😄 Your |
Is there a way I can trigger builds on hydra or is there a darwin NixOS image I can install in VM to test some changes? It's possible we can avoid the use of I can also try out using |
It's doing some crazy stuff I've never seen before: |
I think the installation process builds that file, but never executes the resulting binary, so it's ok to build it in a pure way: |
The comment in https://github.com/bazelbuild/bazel/blob/09222fac7c8851d26e44e087a6beb4ce2ed5dc39/scripts/bootstrap/compile.sh#L314 |
Yes, it's only needed here though: conditional on the environment having an Xcode version override. Following the thread of that data through the code, I think it's originally set here: so it's only necessary if you specify an Xcode version other than the currently selected default, and Bazel has to find where that Xcode is, so it runs the So it's needed to run Bazel correctly in the general case, but it's not needed to run Bazel inside Nix, either during its own build and install phase or when used to build other derivations. |
So we could just patch https://github.com/bazelbuild/bazel/blob/09222fac7c8851d26e44e087a6beb4ce2ed5dc39/scripts/bootstrap/compile.sh#L316 to always use the |
No, because then the resulting Bazel would not support We can patch it to run As I mentioned above I have no way of testing all these changes though. Is the darwin image used in hydra available anywhere? |
Also can we get this PR merged in the meantime? It fixes something that was working before #40525 was merged, and doesn't regress anything else. |
Yeah sure just be aware that this will break once sandboxing is reenabled. |
Sorry, don't know. Worst case is you open a new PR and we let ofborg test it for you 😄 |
@uri-canva Nothing special about it, just an empty machine without the CLT or Xcode installed. The nix installer doesn't have any system dependencies beyond curl/tar unlike eg. homebrew.
|
Motivation for this change
When #40525 was merged darwin support was broken.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)