bazelbuild / bazelbuild/bazel

When the JDK version is upgraded java_tools reports an error. “ijar-cc_binary”error:collect2: fatal error: cannot find 'ld'

Open
#20,420 2 comments 0 reactions 0 assignees View on GitHub
awaiting-user-response P2 team-Rules-Java type: bug
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the bug:

When the JDK version is upgraded java_tools reports an error. “ijar-cc_binary”error:collect2: fatal error: cannot find 'ld'
Oddly enough, when I cleared the cache, the problem disappeared.
In normal cases, does the JDK upgrade affect the cc_binary cache hit?

### Which category does this issue belong to?

Java Rules

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

_No response_

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

centoOS

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

v6.3.0

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

v6.3.0

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

_No response_

### Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

_No response_

### 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 by reproducing the failure in java_tools at the ijar-cc_binary action on CentOS with Bazel 6.3.0, comparing cache behavior before and after a JDK upgrade. Investigate why the cached cc_binary action invokes collect2 without finding ld, and use the cache-clearing observation to define whether JDK changes should invalidate that cache. Done means the cause and expected cache behavior are documented and the error no longer occurs in the relevant scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.