MSVC toolchain flags override windows_subsystem = "windows"

オープン
#4,296 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
build-system

調査の方向性

Start with rust/private/rustc.bzl at the subsystem flag forwarding point cited in the report, then compare it with rules_cc's windows_cc_toolchain_config.bzl linker_subsystem_flag. Run repro.ps1 on Windows x64 with MSVC to reproduce the direct rustc and Bazel outputs. Done means the Rust windows_subsystem attribute determines the Bazel-built executable's PE subsystem rather than the forwarded console flag.

索引モデルが issue の本文から書いたものです。

説明

help wanted needs-triage platform: windows windows

Codex report: rust_binary builds a console executable from #![windows_subsystem = "windows"] on MSVC. Direct rustc produces a GUI executable from the same two-line source. The C++ toolchain supplies /SUBSYSTEM:CONSOLE, and rules_rust forwards it after rustc's subsystem selection.

On Windows x64 with MSVC, install Rust 1.98.0 and Bazelisk, then run:

git clone https://github.com/ashi009/rules-rust-windows-subsystem-repro
cd rules-rust-windows-subsystem-repro
./repro.ps1

Output excerpt from rules_rust 0.70.0:

$ rustc +1.98.0 -Vv
rustc 1.98.0 (88d9e12ae 2026-08-18)
...
$ bazel version
Build label: 8.7.0
...
out/direct.exe : PE subsystem 2 (2 = Windows GUI, 3 = Windows console)
...
bazel-bin/gui.exe : PE subsystem 3 (2 = Windows GUI, 3 = Windows console)

The Windows CI run reproduces this on both 0.70.0 and upstream main at 83d85cce0ab56b42a7466d8b34f4e52949d2d064.

The flag comes from rules_cc's linker_subsystem_flag and is forwarded by rules_rust. The Rust attribute should determine the resulting subsystem.

主要言語
Starlark
スター
857
フォーク
701
平均マージ
4日 7時間
マージ済み PR(30日)
46

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bazelbuild/rules_rust のほかの issue

bazelbuild/rules_rust の issue をすべて見る

似ている issue

Build System の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。