bazelbuild / bazelbuild/bazel

Make remotejdk and other downloaded tools statically linked for linux

Open
#28,351 6 comments 1 reaction 0 assignees View on GitHub
P3 team-OSS team-Rules-Java type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the feature request:

[By default Bazel compiles the code using a JDK it downloads](https://bazel.build/docs/bazel-and-java#config-jvm) using URL and known good hash bundled in bazel; in particular, those binaries (like `javac`) come from outside the distribution used. However, being dynamically linked, they make certain assumptions on the host system: the interpreter (i.e., path to the dynamic linker) is assumed to be `/lib64/ld-linux-x86-64.so.2` and certain libraries (like `libz`) are assumed to be available. While these assumptions holds for many linux distributions, they do not hold for all (e.g., NixOS). Providing statically-linked binaries would make the remote tools work on more systems out of the box.

### Which category does this issue belong to?

_No response_

### What underlying problem are you trying to solve with this feature?

Make bazel in default configuration (e.g., following the [upstream tutorial](https://bazel.build/start/java)) work out of the box on more systems (including NixOS) to allow a more uniform usage of bazel among different distributions and operating systems.

### Which operating system are you running Bazel on?

NixOS

### What is the output of `bazel info release`?

release 8.5.0- (@non-git)

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

`nix-shell -p bazel_8`

More precisely [this derivation of `bazel_8`](https://github.com/NixOS/nixpkgs/blob/3146c6aa9995e7351a398e17470e15305e6e18ff/pkgs/by-name/ba/bazel_8/package.nix)

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

```text

```

### Have you found anything relevant by searching the web?

_No response_

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

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the Bazel Java configuration documentation and the referenced Nixpkgs bazel_8 package.nix derivation to understand how the downloaded remotejdk tools are selected and run. Done means the default Bazel Java tutorial works on NixOS and other Linux systems without assuming /lib64/ld-linux-x86-64.so.2 or libraries such as libz.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, nixos
Domain
build-system, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.