Rustc x86_x64-unknown-uefi target missing?

I'm trying to compile a UEFI crate, but am getting a failure that seems to indicate that I don't have the proper target installed:

$ cargo +nightly  build --target x86_x64-unknown-uefi
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --target x86_x64-unknown-uefi --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit code: 1)
  --- stderr
  error: Error loading target specification: Could not find specification for target "x86_x64-unknown-uefi". Use `--print target-list` for a list of built-in targets

And yet it shows up in rustc's list of built-in targets:

$ rustc +nightly --print target-list | select-string "uefi"

i686-unknown-uefi
x86_64-unknown-uefi

Doing the same build with the other UEFI target, i686-unknown-uefi, succeeds.

I've tried uninstalling and reinstalling Rust (using rustup), but no discernable change. How can I make this target available to Rust? I'm very new to cross compiling with Rust, so I assume I'm just not understanding something about how the toolchains and targets work.

Here's my environment:

  • rustup 1.23.1
  • rustc 1.52.0-nightly (f5d8117c3 2021-03-16)
  • Windows 10 20H2

Figured it out. The issue was a typo in the target name: "x86_64-unknown-uefi" vs "x86_x64-unknown-uefi"

I should've known better than to hand type stuff like that :stuck_out_tongue:

2 Likes