-
Notifications
You must be signed in to change notification settings - Fork 81
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 sometimes needs a full clean to locate ar
#244
Comments
Installing |
Hold on. Having to run |
@mboes Yes, I can confirm that the |
mboes
changed the title
Bazel fails to locate
Bazel sometimes needs a full clean to locate Jul 15, 2018
ar
ar
mboes
added a commit
that referenced
this issue
Jan 12, 2019
To precisely control what binaries are available during compilation, we used to create a single directory called `visible-binaries`, in which we put all the binaries (ghc, haddock, etc) and shell commands (cat, mkdir, etc) that we needed. There was another point to this: build actions could call any binary and that binary could in turn exec any other binary, since `visible-binaries` was in the `PATH`. In this commit, we do away with that. The reason is that there are downsides to this approach: * there is little value in trying to be more hermetic than Bazel is when it comes to shell commands; * all build actions were reusing the same `PATH`, so we were actually exposing more binaries than strictly necessary (each action needs a different subset); * the logic to create `visible-binaries` was pretty complicated, and is now all gone, hence the net code reduction; * crucially, the `visible-binaries` is not going to work on Windows, because no symlinks on that platform and copying doesn't always work (due to limitations of GHC). With this PR merged in, porting to Windows should now be significantly easier. The downside is the following *breaking change*: we have lost the `extra_binaries` field in rules. But that field was introduced for unusual needs that inline-java has, and was a suspicious feature to begin with. Probably fixes #244.
mboes
added a commit
that referenced
this issue
Jan 12, 2019
To precisely control what binaries are available during compilation, we used to create a single directory called `visible-binaries`, in which we put all the binaries (ghc, haddock, etc) and shell commands (cat, mkdir, etc) that we needed. There was another point to this: build actions could call any binary and that binary could in turn exec any other binary, since `visible-binaries` was in the `PATH`. In this commit, we do away with that. The reason is that there are downsides to this approach: * there is little value in trying to be more hermetic than Bazel is when it comes to shell commands; * all build actions were reusing the same `PATH`, so we were actually exposing more binaries than strictly necessary (each action needs a different subset); * the logic to create `visible-binaries` was pretty complicated, and is now all gone, hence the net code reduction; * crucially, the `visible-binaries` is not going to work on Windows, because no symlinks on that platform and copying doesn't always work (due to limitations of GHC). With this PR merged in, porting to Windows should now be significantly easier. The downside is the following *breaking change*: we have lost the `extra_binaries` field in rules. But that field was introduced for unusual needs that inline-java has, and was a suspicious feature to begin with. Probably fixes #244.
mboes
added a commit
that referenced
this issue
Jan 13, 2019
To precisely control what binaries are available during compilation, we used to create a single directory called `visible-binaries`, in which we put all the binaries (ghc, haddock, etc) and shell commands (cat, mkdir, etc) that we needed. There was another point to this: build actions could call any binary and that binary could in turn exec any other binary, since `visible-binaries` was in the `PATH`. In this commit, we do away with that. The reason is that there are downsides to this approach: * there is little value in trying to be more hermetic than Bazel is when it comes to shell commands; * all build actions were reusing the same `PATH`, so we were actually exposing more binaries than strictly necessary (each action needs a different subset); * the logic to create `visible-binaries` was pretty complicated, and is now all gone, hence the net code reduction; * crucially, the `visible-binaries` is not going to work on Windows, because no symlinks on that platform and copying doesn't always work (due to limitations of GHC). With this PR merged in, porting to Windows should now be significantly easier. The downside is the following *breaking change*: we have lost the `extra_binaries` field in rules. But that field was introduced for unusual needs that inline-java has, and was a suspicious feature to begin with. Probably fixes #244.
mboes
added a commit
that referenced
this issue
Jan 13, 2019
To precisely control what binaries are available during compilation, we used to create a single directory called `visible-binaries`, in which we put all the binaries (ghc, haddock, etc) and shell commands (cat, mkdir, etc) that we needed. There was another point to this: build actions could call any binary and that binary could in turn exec any other binary, since `visible-binaries` was in the `PATH`. In this commit, we do away with that. The reason is that there are downsides to this approach: * there is little value in trying to be more hermetic than Bazel is when it comes to shell commands; * all build actions were reusing the same `PATH`, so we were actually exposing more binaries than strictly necessary (each action needs a different subset); * the logic to create `visible-binaries` was pretty complicated, and is now all gone, hence the net code reduction; * crucially, the `visible-binaries` is not going to work on Windows, because no symlinks on that platform and copying doesn't always work (due to limitations of GHC). With this PR merged in, porting to Windows should now be significantly easier. The downside is the following *breaking change*: we have lost the `extra_binaries` field in rules. But that field was introduced for unusual needs that inline-java has, and was a suspicious feature to begin with. Probably fixes #244.
mboes
added a commit
that referenced
this issue
Jan 14, 2019
To precisely control what binaries are available during compilation, we used to create a single directory called `visible-binaries`, in which we put all the binaries (ghc, haddock, etc) and shell commands (cat, mkdir, etc) that we needed. There was another point to this: build actions could call any binary and that binary could in turn exec any other binary, since `visible-binaries` was in the `PATH`. In this commit, we do away with that. The reason is that there are downsides to this approach: * there is little value in trying to be more hermetic than Bazel is when it comes to shell commands; * all build actions were reusing the same `PATH`, so we were actually exposing more binaries than strictly necessary (each action needs a different subset); * the logic to create `visible-binaries` was pretty complicated, and is now all gone, hence the net code reduction; * crucially, the `visible-binaries` is not going to work on Windows, because no symlinks on that platform and copying doesn't always work (due to limitations of GHC). With this PR merged in, porting to Windows should now be significantly easier. The downside is the following *breaking change*: we have lost the `extra_binaries` field in rules. But that field was introduced for unusual needs that inline-java has, and was a suspicious feature to begin with. Probably fixes #244.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated Issue
It seems that some state about where bazel expects
ar
is not updated onbuild
, but requires abazel clean --expunge
to be refreshed. This is considered a bug according to #244 (comment) below.If
ar
is not in$PATH
thenbazel build
fails with the following error message.After installing binutils
nix-env -iA nixos.binutils
, such thatar
is in$PATH
,bazel build
still fails with the same error message.Running
bazel clean --expunge
fixes the issue. Afterwardsbazel build
succeeds. (bazel clean
is not sufficient, the--expunge
flag is required.)Uninstalling
binutils
again causes the same failure ofbazel build
. However, reinstallingbinutils
makesbazel build
succeed without the need forbazel clean --expunge
.In summary:
ar
not in$PATH
bazel build
failsbinutils
(ar
in$PATH
)bazel build
failsbazel clean --expunge
bazel build
succeedsbinutils
bazel build
failsbinutils
bazel build
succeeds (no need forbazel clean --expunge
)binutils
bazel clean --expunge
bazel build
failsbinutils
bazel build
still failsOriginal Issue
Bazel fails to locate
ar
when trying to build a project or its tests.E.g.
This happens, both, when
ar
is in$PATH
(installed vianix-env -iA nixos.binutils
) and when it is not.I'm testing this on NixOS 18.03. The above command was last working when tested on NixOS 17.09.
The text was updated successfully, but these errors were encountered: