bazelbuild / bazelbuild/bazel

default_system_javabase must resolve symlink

Open
#26,449 4 comments 0 reactions 0 assignees View on GitHub
team-Core type: bug untriaged
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 18h
Merged PRs (30d)
75

Description

### Description of the bug:

https://github.com/enola-dev/enola/issues/1205

https://youtrack.jetbrains.com/issue/BAZEL-1788

The root cause of this ^^^ is (or might at least be partially because of, dunno if there's more after) this:

```
WARNING: Running Bazel server needs to be killed, because the following startup options are different:
- Only in old server: --default_system_javabase=/usr/lib/jvm/java-21-openjdk
- Only in new server: --default_system_javabase=/etc/alternatives/java_sdk/
Starting local Bazel server (8.3.1) and connecting to it...
```

BTW: Big THANK YOU to whoever introduced this extremely helpful new (8.3.0+) _WARNING!_

But, given that, at least on my current system (a Fedora Linux Workstation OS), the latter is "just" a symlink to the former:

```sh
$ ll /etc/alternatives/java_sdk
lrwxrwxrwx. root root 28 B 2025-06-19 06:17 /etc/alternatives/java_sdk ⇒ /usr/lib/jvm/java-21-openjdk
```

IMHO it actually should NOT _"Running Bazel server needs to be killed"_ ... because the following startup options are **actually not really** different - do you see what I mean, and agree? (Please don't hesitate to let me know if unclear, and I'm happy to elaborate further.)

I've long been looking for a good excuse to hack a bit on Bazel itself... might fix this be it - would you welcome a PR re. this? Would you like to help me get starting by pointing me to where in the code this might have to get fixed?

### Which category does this issue belong to?

Core? CLI? Configurability?

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

Probably not needed, but if you really wanted to, I guess you could (e.g. or probably even another simpler project) `git clone https://github.com/enola-dev/enola`, on a Fedora Linux Workstation (42), and run a build on the CLI and open it in IntelliJ and you should be able to see the bug.

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

Linux (Fedora, but I strongly suspect that's not relevant, and Debian et al have the same issue).

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

```
bazel info release
WARNING: Running Bazel server needs to be killed, because the following startup options are different:
- Only in old server: --default_system_javabase=/usr/lib/jvm/java-21-openjdk
- Only in new server: --default_system_javabase=/etc/alternatives/java_sdk/
Starting local Bazel server (8.3.1) and connecting to it...
release 8.3.1
```

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

N/A

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

```text
https://github.com/enola-dev/enola.git
72a0d4125486de9229749acb5bcd3fb482eba321
```

### If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

The problem was always there (for me), but only since today with the very helpful new WARNING introduced in 8.3.0 is the root cause finally clear to me.

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

No.

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

No, I'm good - but thanks for asking! 😆

Contributor guide

Open the contributing guide

Research direction

Start with the --default_system_javabase startup option and reproduce the warning using /usr/lib/jvm/java-21-openjdk and the /etc/alternatives/java_sdk symlink shown in the issue. Trace the startup-option comparison and verify that equivalent symlinked paths no longer cause the Bazel server to be killed.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, linux
Domain
build-system, cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.