Skip to content
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 reports build succeeded, but returns non-zero exit code #16066

Closed
meme opened this issue Aug 7, 2022 · 3 comments
Closed

Bazel reports build succeeded, but returns non-zero exit code #16066

meme opened this issue Aug 7, 2022 · 3 comments
Labels
team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug untriaged

Comments

@meme
Copy link

meme commented Aug 7, 2022

Description of the bug:

When running Bazel on an M1 MacBook from both Homebrew and latest git, Verible builds but does not install. All messages from Bazel during the install phase show that it working correctly, however it reports a non-zero exit code and does not write the binaries to the specified install path.

Verible builds fine under Linux and reports a zero status code, and writes the binaries to the install path.

LLDB reports that the process was terminated with exit code 5. In Bash, $? says it dies with exit code 1.

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

$ git clone https://github.com/chipsalliance/verible
$ cd verible
$ bazel run -c opt :install -- ~/bin
INFO: Analyzed target //:install (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //:install up-to-date:
  bazel-bin/_install_gen.sh
  bazel-bin/install
INFO: Elapsed time: 0.143s, Critical Path: 0.05s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
$ echo $?
1

As well, the binaries are not written to ~/bin as requested.

Which operating system are you running Bazel on?

macOS 12.5

What is the output of bazel info release?

release 5.2.0-homebrew and development version

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

I used bazel build //src:bazel-dev as per https://bazel.build/install/compile-source#build-bazel-using-bazel

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

https://github.com/bazelbuild/bazel
fe7deabfa094e35a63b83e7912efeb8097c71bc8
fe7deabfa094e35a63b83e7912efeb8097c71bc8

Have you found anything relevant by searching the web?

No, I have not been able to find other related issues on the issue tracker.

Any other information, logs, or outputs that you want to share?

When I was trying to debug in LLDB, sometimes it failed with an error from waitpid:

$ lldb -- /opt/homebrew/opt/bazel/libexec/bin/bazel-real run -c opt :install -- ~/bin
(lldb) target create "/opt/homebrew/opt/bazel/libexec/bin/bazel-real"
Current executable set to '/opt/homebrew/opt/bazel/libexec/bin/bazel-real' (arm64).
(lldb) settings set -- target.run-args  "run" "-c" "opt" ":install" "--" "$HOME/bin"
(lldb) r
Process 70502 launched: '/opt/homebrew/opt/bazel/libexec/bin/bazel-real' (arm64)
2022-08-07 18:10:46.618045-0400 bazel-real[70502:259617] [Metadata] unable to get a dev_t for store 1795162160.
WARNING: Running Bazel server needs to be killed, because the startup options are different.
Starting local Bazel server and connecting to it...
FATAL: waitpid failed: (error: 4): Interrupted system call
Process 70502 exited with status = 37 (0x00000025)
(lldb) q

But usually it just fails with the exit code 5:

$ lldb -- /opt/homebrew/opt/bazel/libexec/bin/bazel-real run -c opt :install -- ~/bin
(lldb) target create "/opt/homebrew/opt/bazel/libexec/bin/bazel-real"
Current executable set to '/opt/homebrew/opt/bazel/libexec/bin/bazel-real' (arm64).
(lldb) settings set -- target.run-args  "run" "-c" "opt" ":install" "--" "$HOME/bin"
(lldb) r
Process 70545 launched: '/opt/homebrew/opt/bazel/libexec/bin/bazel-real' (arm64)
2022-08-07 18:11:05.640822-0400 bazel-real[70545:259950] [Metadata] unable to get a dev_t for store 1795162160.
INFO: Analyzed target //:install (121 packages loaded, 3153 targets configured).
INFO: Found 1 target...
Target //:install up-to-date:
  bazel-bin/_install_gen.sh
  bazel-bin/install
INFO: Elapsed time: 2.895s, Critical Path: 0.19s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
Process 70545 exited with status = 5 (0x00000005) Terminated due to signal 5
@sgowroji sgowroji added untriaged team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website labels Aug 9, 2022
@meteorcloudy
Copy link
Member

You are running bazel run command, which runs the binary you just built and will return whatever exit code your binary returns. This is probably not a Bazel bug.

@meme
Copy link
Author

meme commented Sep 20, 2022

This works on Linux. Why don't the binaries get placed in their installation directory regardless? The console output indicates it does.

@Wyverald
Copy link
Member

Please take this issue to Verible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug untriaged
Projects
None yet
Development

No branches or pull requests

5 participants