bazelbuild / bazelbuild/rules_cc

default builds on windows failing due to outdated dependencies

Open
#638 1 comment 0 reactions 0 assignees View on GitHub
P2
Dominant language
Starlark
Stars
247
Forks
196
PR merge metrics
No merged PRs in 30d

Description

Building a simple project (i.e., a single cc_binary(..) such as the bazelbuild/examples/cpp-tutorial projects) fails on windows with the following error:

```
ERROR: .../external/rules_swift++non_module_deps+build_bazel_rules_swift_local_config/BUILD:54:58: name 'arch' is not defined
ERROR: package contains errors: : name 'arch' is not defined
```

Confused as to why rules_swift was getting involved in a simple c++ only project being build with MSVC I did some digging.

Bazel mod graph (with some entries omitted to keep it brief) gives:

```
(@_)
└───rules_cc@0.2.17
├───....
└───protobuf@33.4
├───....
├───rules_apple@4.1.0
│ ├───....
│ └───rules_swift@3.1.2
```

The specific issue with rules_swift was [fixed in Nov 2025](https://github.com/bazelbuild/rules_swift/pull/1616), and the fix was included in [release 3.4](https://github.com/bazelbuild/rules_swift/releases/tag/3.4.0).

Although doing a `single_verision_override()` to pin rules_swift to a newer version works, rules_swift is only getting included because of the dep that protobuf has on rules_apple. But protobuf dropped that requirement with version [34.0](https://github.com/protocolbuffers/protobuf/pull/25777).

so TLDR, rules_cc is pulling in an old version of protobuf which pulls in an old version of rules_swift which doesn't run on windows even if all you want to do is build a simple `cc_binary()`

I see that `rules_cc/MODULE.bazel` only specifies protobuf 27.0, so I'm assuming Version 33.4 is coming from somewhere else in the dep graph (there are a number of circular dependencies on protobuf inside the protobuf dep graph).

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Windows build of a simple cc_binary and inspect the Bazel module graph. Read rules_cc/MODULE.bazel and trace where protobuf 33.4 and the transitive rules_apple/rules_swift dependencies are selected. Done means the default dependency resolution no longer causes the C++-only build to fail on Windows.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.