bazelbuild / bazelbuild/bazel

compiler_param_file does not use custom flag prefix from "flag_groups"

Open
#16,168 6 comments 0 reactions 0 assignees View on GitHub
area-Windows not stale P3 platform: windows team-Rules-CPP type: bug
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 18h
Merged PRs (30d)
75

Description

### Description of the bug:

On Windows there is a need to enable "compiler_param_file" feature to solve 32k chars CreateProcessW limit.

If compiler does not support @ synax (`g++ @file.txt`) but requires custom flag, default feature implementation should be changed.

My version:

```
compiler_param_file_feature = feature(
name = "compiler_param_file",
enabled = True,
flag_sets = [
flag_set(
actions = [
ACTION_NAMES.c_compile,
ACTION_NAMES.cpp_compile,
],
flag_groups = [
flag_group(
flags = ["--cmd_file", "%{compiler_param_file}"],
expand_if_available = "compiler_param_file",
),
],
),
],
)
```

Feature is enabled, but I still see `@` prefix instead of `--cmd_file`:
```
external\ti\bin\cl6x.exe @bazel-out/wintic6000-fastbuild/bin/cpp/src/_objs/mycpplib_c/mycpplib.o.params
```

### 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?

Windows

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

5.1.1

### 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 master; git rev-parse HEAD` ?

_No response_

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

No

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

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing the compiler_param_file feature and its flag_groups handling, then reproduce the Windows case from the issue with Bazel 5.1.1. Done means a compiler requiring a custom parameter-file flag receives that flag instead of the default @ prefix.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, compilers
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.