I have a simple CLI written in Rust which I'm building on the GNU toolchain on Windows 10. As per rustup show:
installed toolchains
--------------------
stable-x86_64-pc-windows-gnu (active, default)
stable-x86_64-pc-windows-msvc
active toolchain
----------------
name: stable-x86_64-pc-windows-gnu
active because: it's the default toolchain
installed targets:
x86_64-pc-windows-gnu
I wanted my CLI to make a call to AWS, so I added this to Cargo.toml:
[dependencies]
aws-config = { version = "1.6.3", features = ["behavior-version-latest"] }
(I am aware that the AWS SDK for Rust requires an async library, but I'm taking this a step at a time.)
Even without adding any AWS-related code to my CLI, the addition of this dependency made my build fail with:
error: Error calling dlltool 'dlltool.exe': program not found
Following the Rustup Book's Windows docs, I installed MSYS2, but I still could find no dlltool.exe.
Compiling raw-dylib doesn't work on Windows #103939 says something about this and mentioned raw-dylib doesn't work on Windows with x86_64-pc-windows-gnu #140704, which says:
… Putting an LLVM dlltool renamed to
dlltool.exein yourPATH.
OK, so where do I get a dlltool.exe?
The Microsoft C++ Build Tools license allows compiling open-source dependencies, so I downloaded the Microsoft C++ Build Tools, selecting:
- MSVC (currently v143 - VS 2022 C++ x64/x86 build t…)
- Windows 11 SDK (currently 10.0.26100.3916)
After installation of the Microsoft C++ Build Tools, I still can't find a dlltool.exe anywhere.
Error: Error calling dlltool ‘dlltool.exe’: program not found says it found a solution:
make sure the
rust-mingwcomponent is installed, it should contain adlltool.
After yet more searching for rust-mingw, I found Install rust-mingw component when adding a target #607. This is from 2016, so I'm not sure it's even relevant—but it's still open. It says there is something called rust-mingw I need to "download and copy", but doesn't tell me how:
When adding the target
i686-pc-windows-gnu, rustup only installs rust-std, not rust-mingw. To cross-compile we need mingw component.
When manually downloaded and copied rust-mingw, compile works well.
Where can I find a dlltool.exe for accessing the AWS SDK for Rust on Windows 10 using the GNU toolchain?