Description
Verification
- I searched for recent similar issues at https://github.com/rust-lang/rustup/issues?q=is%3Aissue+is%3Aopen%2Cclosed and found no duplicates.
- I am on the latest version of Rustup according to https://github.com/rust-lang/rustup/tags and am still able to reproduce my issue.
Problem
Hi! I am developping a rustc driver. I make sure to always call it as rustup run my-driver
, which works on Mac and Linux: both the toolchain binaries and the rustc_driver.so are accessible so my program runs well. On Windows however, calling the driver fails with "rustc_driver.dll not found".
And indeed, as far as I can tell rustup run
only attempts to set up loader paths on macos and linux:
Line 178 in 895a43a
I've seen related issues (#765, #932, #1152), but they're not exactly the same problem.
Steps
- Install the required rustup components:
rustup component add --toolchain nightly rust-src rustc-dev llvm-tools-preview
; - Make a minimal binary crate that dynamically links to rustc-internal crates:
#![feature(rustc_private)]
extern crate rustc_driver;
fn main() {
println!("Hello, World!");
}
cargo +nightly build
- Run the resulting binary on Windows with
rustup run nightly path\to\test-crate.exe
Possible Solution(s)
I can't test myself because I don't own a Windows machine, but a user reports that adding the lib path (e.g. C:\Users\Administrator\.rustup\toolchains\nightly-2024-10-23-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib
), to PATH
(instead of LD_LIBRARY_PATH
) works. This seems confirmed by a quick google search.
Notes
The reproducing details (OS version etc) are not precise because I'm reporting on behalf of a user. If you can't reproduce on your Windows machine I'll ask for more details.
Rustup version
rustup 1.27.1
Installed toolchains
nightly
OS version
Windows ???