Skip to content

Bazel 3.7.0 can't be compiled on Alpine linux #12460

@kigero

Description

@kigero

Description of the problem / feature request:

Bazel 3.7.0 can't be compiled on Alpine linux; I get the following error:

$ wget https://github.com/bazelbuild/bazel/releases/download/3.7.0/bazel-3.7.0-dist.zip && unzip bazel-3.7.0-dist.zip
$ env EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk" bash ./compile.sh
Building Bazel from scratch......
Building Bazel with Bazel.
<snip>
    Compiling src/main/tools/linux-sandbox.cc; 0s local
src/main/tools/linux-sandbox-pid1.cc: In function 'int WaitForChild()':
src/main/tools/linux-sandbox-pid1.cc:402:23: error: 'TEMP_FAILURE_RETRY' was not declared in this scope
  402 |     const pid_t pid = TEMP_FAILURE_RETRY(wait(&status));
      |                       ^~~~~~~~~~~~~~~~~~

It seems that TEMP_FAILURE_RETRY is only available on GNU libc, where Alpine uses musl libc. The last Bazel version I tried on Alpine was 3.5.0 and that was compiling/running fine.

What operating system are you running Bazel on?

Alpine linux, 3.13.0_alpha20200917. Running within docker using the alpine:edge tag.

Have you found anything relevant by searching the web?

  1. The line that errors was added in commit 1517af1.
  2. I found a definition for TEMP_FAILURE_RETRY on StackOverflow that does seem to work (meaning, compilation succeeds) when added to the linux-sandbox-pid1.cc file, but this is not my area of expertise so I can't tell if it's actually doing what it's supposed to do, or if it just looks like it is.

Metadata

Metadata

Assignees

Labels

P2We'll consider working on this in future. (Assignee optional)team-OSSIssues for the Bazel OSS team: installation, release processBazel packaging, websitetype: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions