homebrew-core icon indicating copy to clipboard operation
homebrew-core copied to clipboard

bazel 5.3.1

Open chenrui333 opened this issue 2 years ago • 4 comments

Created by brew bump


Created with brew bump-formula-pr.

chenrui333 avatar Sep 19 '22 22:09 chenrui333

on linux:

  ==> /home/linuxbrew/.linuxbrew/Cellar/bazel/5.3.1/bin/bazel build //:bazel-test
  file is invalid or corrupted (missing end of central directory record)
  Opening zip "/home/linuxbrew/.linuxbrew/Cellar/bazel/5.3.1/libexec/bin/bazel-real": Cannot find central directory
  FATAL: Failed to open '/home/linuxbrew/.linuxbrew/Cellar/bazel/5.3.1/libexec/bin/bazel-real' as a zip file: (error: 5): Input/output error

chenrui333 avatar Sep 20 '22 00:09 chenrui333

Weird, I cannot reproduce this failure locally. Might be worth trying to deparallelize the build.

danielnachun avatar Sep 20 '22 07:09 danielnachun

let's give a re-run before updating the build flow.

chenrui333 avatar Sep 20 '22 23:09 chenrui333

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. To keep this pull request open, add a help wanted or in progress label.

github-actions[bot] avatar Sep 23 '22 00:09 github-actions[bot]

#111955

chenrui333 avatar Sep 29 '22 13:09 chenrui333

Weird, I cannot reproduce this failure locally. Might be worth trying to deparallelize the build.

@danielnachun I think I can reproduce this issue in codespace. (looks like we did strip the binary when installing bazel-real?), can you help me understand that? Thanks!

Here are the error logs

@chenrui333 ➜ /workspaces/homebrew-core xxx $ bazel --help
WARNING: Invoking Bazel in batch mode since it is not invoked from within a workspace (below a directory having a WORKSPACE file).
file is invalid or corrupted (missing end of central directory record)
Opening zip "/home/linuxbrew/.linuxbrew/Cellar/bazel/5.3.2/libexec/bin/bazel-real": Cannot find central directory
FATAL: Failed to open '/home/linuxbrew/.linuxbrew/Cellar/bazel/5.3.2/libexec/bin/bazel-real' as a zip file: (error: 5): Input/output error

@chenrui333 ➜ /workspaces/homebrew-core xxx $ uname -a
Linux codespaces-d485d1 5.4.0-1094-azure #100~18.04.1-Ubuntu SMP Mon Oct 17 11:44:30 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

@chenrui333 ➜ /workspaces/homebrew-core xxx $ file /home/linuxbrew/.linuxbrew/Cellar/bazel/5.3.2/libexec/bin/bazel-real
/home/linuxbrew/.linuxbrew/Cellar/bazel/5.3.2/libexec/bin/bazel-real: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /home/linuxbrew/.linuxbrew/lib/ld.so, for GNU/Linux 3.2.0, BuildID[sha1]=308deeb38d8592a0887a52201363e6bc498efa5d, not stripped

@chenrui333 ➜ /workspaces/homebrew-core (bump-oil-0.12.9 ✗) $ file /home/linuxbrew/.linuxbrew/Cellar/bazel/5.3.2/bin/bazel
/home/linuxbrew/.linuxbrew/Cellar/bazel/5.3.2/bin/bazel: Bourne-Again shell script, ASCII text executable
@chenrui333 ➜ /workspaces/homebrew-core (bump-oil-0.12.9 ✗) $ uname -a
Linux codespaces-d485d1 5.4.0-1094-azure #100~18.04.1-Ubuntu SMP Mon Oct 17 11:44:30 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

chenrui333 avatar Nov 28 '22 03:11 chenrui333

It's possible that is actually somewhat related to the problems in https://github.com/Homebrew/homebrew-core/pull/116717, which seems to be happening because they append a compressed archive to the end of an ELF binary (if I understand their Makefile). Bazel is much harder to understand but that error may imply that there is similarly some sort of problem with an archive embedded within the binary.

I haven't been able to examine the output yet because I can't even get bazel 5.3.2 to build from source successfully. But once I hopefully do then I can take a look at what's going on there.

danielnachun avatar Nov 29 '22 19:11 danielnachun

https://github.com/bazelbuild/bazel/issues/600#issuecomment-156456154

The bazel binary is a tiny C++ launcher with a zip file tacked on its butt.

So it does sound like our relocation can't handle these "binaries".


A full unzip bazel-real still works so it is still seen as a valid archive.

Bazel is looking for some specific locations in zip file: https://github.com/bazelbuild/bazel/blob/5.3.2/src/main/cpp/archive_utils.cc#L38-L54 https://github.com/bazelbuild/bazel/blob/5.3.2/third_party/ijar/zip.cc#L720-L760

cho-m avatar Nov 30 '22 01:11 cho-m

I think we have enough to make a new issue as both oil and bazel have what appear to be identical problems. My guess is that either our patchelf.rb doesn't implement something correctly from upstream patchelf, or the patchelf upstream itself is broken as well.

Interestingly I have packaged oil myself in Anaconda and bazel is already packaged, so it is possible to do some relocation on these without breaking them. I think the most useful thing we can do as a starting point is to build oil (and bazel if we can get it to work) from source with brew install --build-from-source and brew install --build-bottle followed by brew bottle and compare the binaries. That should make it really easy to compare the binaries and figure out how they are getting broken.

danielnachun avatar Nov 30 '22 04:11 danielnachun

bazel 5.3.0 was packaged before the Linux migration. Current 5.3.2 is probably broken as we disabled the test on Linux.

I think existing Linux oil bottle is also the same. It was built on Ubuntu 16.04.

Relocation failures are with new Linux toolchain.

cho-m avatar Nov 30 '22 09:11 cho-m

bazel 5.3.0 was packaged before the Linux migration. Current 5.3.2 is probably broken as we disabled the test on Linux.

yeah, we have tested before disabling the test. Should remove the bottle for bazel as well?

chenrui333 avatar Dec 28 '22 02:12 chenrui333

Yes, we should drop the bazel bottle for now until we can fix the patchelf issues.

danielnachun avatar Dec 29 '22 22:12 danielnachun