Open flipsi opened 1 year ago
Hi @flipsi , Could you please provide more details on the above issue. Am not able to reproduce the above error. I can build successfully in linux and MacOs too.
Hi @flipsi , Could you please provide more details on the above issue. Am not able to reproduce the above error. I can build successfully in linux and MacOs too.
Hi @sgowroji, thanks for your fast reply! I'm happy to provide more details if you tell me what exactly is needed.
@sgowroji I ran into the same issue apparently:
$ bazel build //scripts:fish_completion INFO: Analyzed target //scripts:fish_completion (0 packages loaded, 0 targets configured). ERROR: /tmp/bazel/src/main/starlark/builtins_bzl/BUILD:16:8: Building builtins_bzl.zip //src/main/starlark/builtins_bzl:builtins_bzl_zip [for tool] failed: (Exit 127): bash failed: error executing Genrule command (from target //src/main/starlark/builtins_bzl:builtins_bzl_zip) /bin/bash -c ... (remaining 1 argument skipped) Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging /bin/bash: line 1: bazel-out/k8-opt-exec-ST-fad1763555eb/bin/src/zip_builtins: No such file or directory Target //scripts:fish_completion failed to build Use --verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 0.315s, Critical Path: 0.19s INFO: 21 processes: 18 internal, 3 linux-sandbox. ERROR: Build did NOT complete successfully
$ ls bazel-out/k8-opt-exec-ST-fad1763555eb/bin/src/zip_builtins
bazel-out/k8-opt-exec-ST-fad1763555eb/bin/src/zip_builtins
The file that is mentioned as missing exists under that location, though. I haven't looked into details, but it looks like a race condition. However, the error came out 10/10 on my machine with today's master branch at 13bd828893be702f960027b83e9b2e4649a0bd37
To chime in, I can build them :/.
$ git log --oneline -1
1e9ca85d80 (origin/master, origin/HEAD) Print file names without root base in progress messages
$ bazel version
Bazelisk version: development
Build label: 7.0.0
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Mon Dec 11 16:51:49 2023 (1702313509)
Build timestamp: 1702313509
Build timestamp as int: 1702313509
$ bazel build //scripts:fish_completion
# ...
INFO: Found 1 target...
Target //scripts:fish_completion up-to-date:
bazel-bin/scripts/bazel.fish
INFO: Elapsed time: 155.570s, Critical Path: 93.86s
INFO: 3063 processes: 71 internal, 2131 linux-sandbox, 1 local, 860 worker.
INFO: Build completed successfully, 3063 total actions
$ sha256sum bazel-bin/scripts/bazel.fish
4f9fc290b1698a19b1afd7c369aeadcfd6e9c2504cfbf49658f7c582acb25690 bazel-bin/scripts/bazel.fish
$ source bazel-bin/scripts/bazel.fish
# successfully sourced.
I dug a little deeper. The root cause seems to be symlinks not set correctly when cloning the bazel repo under /tmp/bazel
With --sandbox_debug
, I realized the script changes directory, and from that changed directory the symlink to zip_builtins
is broken:
frederik.beaujean@fred-p1:~/.cache/bazel/_bazel_frederik.beaujean/18dbd9f3d77ee103aaae087f6df97588/sandbox/linux-sandbox/1361/execroot/_main$ ll bazel-out/k8-opt-exec-ST-fad1763555eb/bin/src/zip_builtins
lrwxrwxrwx 1 frederik.beaujean frederik.beaujean 84 Jan 15 10:33 bazel-out/k8-opt-exec-ST-fad1763555eb/bin/src/zip_builtins -> /tmp/bazel-execroot/_main/bazel-out/k8-opt-exec-ST-fad1763555eb/bin/src/zip_builtins
I moved the repo to ~/Downloads/bazel/
and from there, I can build the fish rules just fine.
@stagnation What was your build directory? @flipsi Can you rebuild again under a different folder?
Could you test this with USE_BAZEL_VERSION=last_green
? 7.0.0 has a bunch of sandbox-related issues.
@fmeum You guessed right, I was using v7.0.0, the same as @stagnation mentioned above. Your workaround also works
/t/bazel$ pwd /tmp/bazel
/t/bazel$ USE_BAZEL_VERSION=last_green bazel build //scripts:fish_completion
INFO: Found 1 target...
Target //scripts:fish_completion up-to-date:
bazel-bin/scripts/bazel.fish
INFO: Elapsed time: 274.126s, Critical Path: 113.33s
INFO: 3006 processes: 14 internal, 2131 linux-sandbox, 1 local, 860 worker.
INFO: Build completed successfully, 3006 total actions
Just the repo root
11:21 m ██ ~/bin/git/bazel ls
bazel-bazel@ bazel-testlogs@ scripts/ third_party/ BUILD CODE_OF_CONDUCT.md LICENSE README.md WORKSPACE.bzlmod combine_distfiles_to_tar.sh* extensions.bzl repositories.bzl trace
bazel-bin@ examples/ site/ tools/ CHANGELOG.md CONTRIBUTING.md MODULE.bazel SECURITY.md bazel_downloader.cfg compile.sh* maven_install.json requirements.txt workspace_deps.bzl
bazel-out@ output/ src/ AUTHORS CODEOWNERS CONTRIBUTORS MODULE.bazel.lock WORKSPACE combine_distfiles.py* distdir.bzl rbe_extension.bzl tags
11:22 m ██ ~/bin/git/bazel bazel build //scripts:fish_completion --announce_rc
Starting local Bazel server and connecting to it...
INFO: Reading 'startup' options from /home/nils/.bazelrc: --output_user_root=/CAS/bazel-cache/
INFO: Options provided by the client:
Inherited 'common' options: --isatty=1 --terminal_columns=283
INFO: Reading rc options for 'build' from /home/nils/bin/gits/bazel/.bazelrc:
Inherited 'common' options: --enable_platform_specific_config --check_direct_dependencies=error --experimental_downloader_config=bazel_downloader.cfg
INFO: Reading rc options for 'build' from /home/nils/bin/gits/bazel/.bazelrc:
'build' options: --java_language_version=11 --tool_java_language_version=11 --incompatible_disallow_empty_glob --incompatible_enable_cc_toolchain_resolution --incompatible_sandbox_hermetic_tmp
INFO: Found applicable config definition build:linux in file /home/nils/bin/gits/bazel/.bazelrc: --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
INFO: Analyzed target //scripts:fish_completion (484 packages loaded, 10555 targets configured).
INFO: Found 1 target...
Target //scripts:fish_completion up-to-date:
bazel-bin/scripts/bazel.fish
INFO: Elapsed time: 3.719s, Critical Path: 0.32s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
11:22 m ██ ~/bin/git/bazel bazel version
Bazelisk version: development
Build label: 7.0.0
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Mon Dec 11 16:51:49 2023 (1702313509)
Build timestamp: 1702313509
This should be fixed in 7.0.1 then.
Description of the bug:
When building the fish completion script (as desribed in
scripts/fish/README.md
), I observe the following error:What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
bazel build //scripts:fish_completion
Which operating system are you running Bazel on?
Arch Linux (Kernel: Linux 6.1.8-arch1-1)
What is the output of
bazel info release
?release 6.0.0
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?Have you found anything relevant by searching the web?
I did not find this issue on SO, Github issues or email threads.
At least I found out via this issue that fish completion is generally supported, which is unfortunately not documented on the website. This is how I discovered
scripts/fish/README.md
in the first place.Any other information, logs, or outputs that you want to share?
On Arch Linux, I installed bazel from the bazelisk community package rather than compiling it from source (The cloned source was only used to build the fish completions):