bazelbuild / bazelbuild/rules_cc

rules_cc runfiles library does not provide `BAZEL_CURRENT_REPOSITORY`

Closed
#285 4 comments 0 reactions 0 assignees View on GitHub
P3
Dominant language
Starlark
Stars
247
Forks
196
PR merge metrics
No merged PRs in 30d

Description

### Description of the problem / feature request:

The runfiles library has been deprecated in bazel-tools and now points to the library in rules_cc, but the instructions ported over refer to [BAZEL_CURRENT_REPOSITORY](https://github.com/bazelbuild/rules_cc/blob/5be90a4e04e64df0e9d26382e1006d3df21aaa91/cc/runfiles/runfiles.h#L37), which is not present in the rules_cc runfiles library.

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

I made a branch off something I was working on. You should be able to run `touch data/inputs/01.txt && bazel build //src/day/01` using //https://github.com/flurie/aoc-2024/tree/demo-rules-cc-runfiles if you install the prereqs (nix and devenv) and it should work on macOS and Linux.

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

macOS 14.5

### What's the output of `bazel info release`?

`release 7.4.1- (@non-git)`

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

It is built from nixpkgs 24.11.

### What version of rules_cc do you use? Can you paste the workspace rule used to fetch rules_cc? What other relevant dependencies does your project have?

```
http_archive(
name = "rules_cc",
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.17/rules_cc-0.0.17.tar.gz"],
sha256 = "abc605dd850f813bb37004b77db20106a19311a96b2da1c92b789da529d28fe1",
strip_prefix = "rules_cc-0.0.17",
)
```

### What Bazel options do you use to trigger the issue? What C++ toolchain do you use?

.bazelrc:
```
build --host_platform=@rules_nixpkgs_core//platforms:host
build --crosstool_top=@nixpkgs_config_cc//:toolchain
```

for completeness, the output when the repro command is run with `--announce_rc`:
```
INFO: Reading 'startup' options from /nix/store/zsyc077bgm4g3xq3h0a2qfzw4g4jzjfi-bazel-rc: --server_javabase=/nix/store/dd8l9acgfnax38j7wvz0lh96c2vkxyg3-zulu-ca-jdk-21.0.4
INFO: Options provided by the client:
Inherited 'common' options: --isatty=1 --terminal_columns=104
INFO: Reading rc options for 'run' from /nix/store/zsyc077bgm4g3xq3h0a2qfzw4g4jzjfi-bazel-rc:
Inherited 'build' options: --extra_toolchains=@bazel_tools//tools/jdk:all --tool_java_runtime_version=local_jdk --java_runtime_version=local_jdk
INFO: Reading rc options for 'run' from /Users/flurie/Repos/github.com/flurie/aoc-2024/.bazelrc:
Inherited 'build' options: --host_platform=@rules_nixpkgs_core//platforms:host --crosstool_top=@nixpkgs_config_cc//:toolchain
```

toolchain:
```
nixpkgs_git_repository(
name = "nixpkgs",
revision = "release-24.11",
)

nixpkgs_cc_configure(
name = "nixpkgs_config_cc",
repository = "@nixpkgs",
)
```

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

No

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

No

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.