MSVC toolchain flags override windows_subsystem = "windows"

Abierto
#4,296 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
68/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
rust
Área
build-system

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Starlark
Estrellas
857
Forks
701
Merge medio
4 d 7 h
PR fusionados (30 d)
46

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de bazelbuild/rules_rust

Todos los issues de bazelbuild/rules_rust

Issues similares

Más issues de Build System

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.