Closed as duplicate of#103939
Description
Note: This is the same bug as #103939.
But now it also happens when compiling on Windows using the x86_64-pc-windows-gnu
toolchain and compiling for x86_64-pc-windows-gnu
. This is a common default scenario without any cross-compiling involved.
I tried this code:
fn main() {
unsafe {
MessageBoxA(0, b"hello\0".as_ptr(), "world\0".as_ptr(), 0);
}
}
#[link(name = "user32", kind = "raw-dylib")]
unsafe extern "system" {
fn MessageBoxA(hwnd: usize, lptext: *const u8, lpcaption: *const u8, flags: u32) -> i32;
}
I expected to see this happen:
Successful compilation
Instead, this happened:
C:\wintest>cargo build
Compiling wintest v0.1.0 (C:\wintest)
error: Error calling dlltool 'dlltool.exe': program not found
error: could not compile `wintest` (bin "wintest") due to 1 previous error
Meta
rustc --version --verbose
:
rustc 1.88.0-nightly (2e6882ac5 2025-05-05)
binary: rustc
commit-hash: 2e6882ac5be27a73293d6f7ae56397fdf32848de
commit-date: 2025-05-05
host: x86_64-pc-windows-gnu
release: 1.88.0-nightly
LLVM version: 20.1.4
Workaround
The same workaround as discussed in #103939 also works for this issue: Putting an LLVM dlltool renamed to dlltool.exe
in your PATH
.
This was considered fine as a temporary workaround in #103939, because fixing the cross-compilation issue didn't seem urgent. However, this is now affecting the default compilation on x86_64-pc-windows-gnu
, hence I hope for a permanent fix soon.