compilation fails due to dlltool missing
Sorry for a noob question once again. I cannot compile a project depending on chrono crate after updating it from 0.4.39 to 0.4.40 (and also to latest 0.4.41).
$ cargo-zigbuild build --target x86_64-pc-windows-gnu --release
[...]
error: Error calling dlltool 'x86_64-w64-mingw32-dlltool': No such file or directory (os error 2)
error: could not compile `chrono` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
Do I need to install this tool manually from package manager or is Zig/cargo-zigbuild responsible for providing this?
I'm also hitting this one. It used to work with zigbuild, I'm not sure whether zig, cargo-zigbuild, or something about the rust toolchain broke it.
❯ cargo-zigbuild --version
cargo-zigbuild 0.20.0
❯ zig version
0.13.0
❯ cargo --version
cargo 1.87.0 (99624be96 2025-05-06)
❯ cat rust-toolchain.toml
[toolchain]
channel = "1.87.0" # See workspace Cargo.toml
components = ["rust-src", "rust-analyzer"]
profile = "default"
targets = ["x86_64-pc-windows-gnu", "x86_64-unknown-linux-musl", "aarch64-unknown-linux-musl", "aarch64-apple-darwin"]
Real world example: https://github.com/NexusSocial/identity/pull/50
This is due to the windows crate starts to use raw-dylib in recent versions, it requires dlltool, rustc expects gnu dlltool I'm not sure if zig dlltool would work or not but we can try.
For now you can install mingw-w64 to workaround the issue I think.
I'm not sure if zig dlltool would work or not but we can try.
I just created a /usr/local/bin/x86_64-w64-mingw32-dlltool like this:
#!/bin/sh
/usr/bin/zig dlltool "$@"
To my utter surprise, it worked…
What would be the proper way to use Zig as dlltool for x86_64-w64-mingw32-dlltool (and maybe other versions of dlltool, if they exist)?
There is a rust-mingw rustup component but it only seems to be provided on windows hosts, which rather defeats the point