Skip to content

Building aws-lc-rs with FIPS enabled on Windows ARM64 fails due to x64/ARM64 toolchain mismatch during native CMake build. #1057

@sfc-gh-fpawlowski

Description

@sfc-gh-fpawlowski

Problem:

Building aws-lc-rs with FIPS enabled on Windows ARM64 fails due to x64/ARM64
toolchain mismatch during native CMake build.

In our CI (windows-11-arm runner), we target aarch64-pc-windows-msvc and
call vcvarsall.bat arm64 before cargo build.
However, the aws-lc-fips-sys build path appears to override this by invoking
vcvarsall.bat x64 via its Windows helper script, which results in x64
libraries being selected in the FIPS CMake subprocess and causes linker failure:

library machine type 'x64' conflicts with target machine type 'ARM64'

Non-FIPS builds (via aws-lc-sys) work on the same runner/target; the failure
is specific to the FIPS path (aws-lc-fips-sys).

Relevant details

AWS-LC for Rust versions or commit:

  • aws-lc-rs = 1.16.1
  • aws-lc-fips-sys = 0.13.12
  • cmake = 0.1.54

System information:

  • CPU architecture: ARM64 (aarch64)
  • CPU name: GitHub-hosted Windows ARM runner (windows-11-arm)
  • OS: Windows 11 ARM (GitHub Actions hosted image)

Verified reproduction

In snowflakedb/universal-driver PR #427
on windows-11-arm, building sf_core with --all-features (which enables
rustls/fipsaws-lc-fips-sys) targeting aarch64-pc-windows-msvc fails
with LNK1112 x64 vs ARM64 conflict.

Likely minimal reproducer (not yet validated end-to-end)

Cargo.toml:

[package]
name = "fips-arm64-repro"
edition = "2021"

[dependencies]
aws-lc-rs = { version = "1.16", features = ["fips"] }

src/main.rs:

fn main() {
    aws_lc_rs::init();
    println!("aws-lc-rs FIPS loaded");
}

Steps:

  1. Use a Windows ARM64 machine (observed on GitHub Actions windows-11-arm;
    may also reproduce with x64 host cross-compiling to ARM64 target).
  2. Set up ARM64 MSVC environment:
    call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" arm64
    
  3. Install target: rustup target add aarch64-pc-windows-msvc
  4. Build:
    cargo build --target aarch64-pc-windows-msvc
    
  5. Expected: linker error with x64 vs ARM64 machine type conflict.

Observed behavior in source/build path:

  • aws-lc-fips-sys/builder/printenv.bat (lines 30-37) calls vcvarsall.bat x64.
  • aws-lc-fips-sys/builder/cmake_builder.rs (lines 273-281) imports env from
    that script for Windows builds via collect_vcvarsall_bat().
  • This overrides the caller's ARM64 env (vcvarsall arm64) for the FIPS CMake
    build path.
  • The non-FIPS path (aws-lc-sys/builder/cmake_builder.rs lines 305-324) has
    explicit ARM64 Windows handling and works correctly.

Expected behavior:

  • When target is aarch64-pc-windows-msvc, FIPS build should respect the
    target architecture and produce ARM64-compatible artifacts, consistent with
    how aws-lc-sys (non-FIPS) handles it.

Build log (from CI run above):

error: failed to run custom build command for `aws-lc-fips-sys v0.13.12`
...
link : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'ARM64'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions