bazelbuild / bazelbuild/bazel

The abseil is incompatible with risc-v platform in bazel7.4.1

Open
#29,290 1 comment 0 reactions 0 assignees View on GitHub
P4 team-OSS 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 trying running bazel7.4.1 on risc-v platform, Illegal instruction happends. GDB it we figured that is because the abseil module:

Missing separate debuginfos, use: dnf debuginfo-install glibc-2.38-34.eos30.riscv64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".
[New Thread 0x7ffff73ff0a0 (LWP 285921)]
[New Thread 0x7fffee9ff0a0 (LWP 285922)]
[New Thread 0x7ffff6bfe0a0 (LWP 285923)]

Thread 2 "default-executo" received signal SIGILL, Illegal instruction.
[Switching to Thread 0x7ffff73ff0a0 (LWP 285921)]
0x0000555555863180 in absl::lts_20230125::base_internal::UnscaledCycleClock::Now() ()
Missing separate debuginfos, use: dnf debuginfo-install libgcc-12.3.1-33.eos30.riscv64

And this is because "starting with Linux 6.6 [1], RDCYCLE is a privileged instruction on RISC-V and can't be used directly from userland. There is a sysctl option to change that as a transition period, but it will eventually disappear.
The RDTIME instruction is another less accurate alternative, however its frequency varies from board to board, and there is currently now way to get its frequency from userland" more detail could be found in
https://github.com/abseil/abseil-cpp/pull/1644
Which refers that this is actually a fixed bug. But When I try to fix it, I can't find absl/base/internal/unscaledcycleclock.cc
Could you help me?

### Which category does this issue belong to?

_No response_

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

Image

Image

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

"PolyOS Server

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

_No response_

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

_No response_

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

```text

```

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

_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

Reproduce the SIGILL on Bazel 7.4.1 running on the reported RISC-V PolyOS Server platform and inspect the Abseil code around absl::base_internal::UnscaledCycleClock::Now(). Compare the vendored Abseil version with the fix described in Abseil PR 1644, noting that absl/base/internal/unscaledcycleclock.cc is not present. Done means Bazel no longer executes the illegal RDCYCLE instruction on this platform.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.