Skip to content

rustc uses wrong build tools when compiling from MSVC #133794

Closed
@dlon

Description

@dlon

This is due to an issue in cc-rs, rust-lang/cc-rs#1308, which is a dependency in rustc_llvm/rustc_codegen_ssa. There is a fix in progress (not yet released/merged): rust-lang/cc-rs#1310. This is a problem as of Rust 1.83.

The issue can be reproduced by creating a cargo workspace with an empty build.rs, creating a new MSVC project within that workspace and running cargo build from within the Pre-Build Event of that MSVC project. When targeting something other than the native arch, cargo/rustc will use the wrong build tools for linking or compilation.

I can provide more details/examples if necessary.

EDIT: This should be fixed on its own once cc is updated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-crossArea: Cross compilationC-bugCategory: This is a bug.O-windows-msvcToolchain: MSVC, Operating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions