MSVC toolchain flags override windows_subsystem = "windows"

Đang mở
#4,296 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
build-system

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Starlark
Star
857
Fork
701
Merge trung bình
4 ngày 7 giờ
Pull request đã merge (30 ngày)
46

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của bazelbuild/rules_rust

Tất cả issue của bazelbuild/rules_rust

Issue tương tự

Thêm issue về Build System

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.