You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rustup run doesn't setup the dylib path on windows #4246
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:
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.
But I don't see why PATH can't be appended with libdir by rustup, saying adding C:\Users\Administrator\.rustup\toolchains\nightly-2024-10-23-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib to PATH.
Update: after scanning C:\Users\Administrator\.rustup\toolchains\nightly-2024-10-23-x86_64-pc-windows-msvc\bin and C:\Users\Administrator\.rustup\toolchains\nightly-2024-10-23-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib, it seems the latter contains more deps dlls which might cause troubles? Can rustup create a dir only containing rust dll libs, and add it to PATH?
Activity
rami3l commentedon Mar 11, 2025
@Nadrieril Thanks for your report.
You might need to set
RUSTUP_WINDOWS_PATH_ADD_BIN=1to make it work. If this is the case then this is a duplicate of #3825.zjp-CN commentedon Mar 12, 2025
Thanks for the link.
RUSTUP_WINDOWS_PATH_ADD_BIN=1solves the problem for now.Also related to these links:
RUSTUP_WINDOWS_PATH_ADD_BIN#4196But I don't see why
PATHcan't be appended with libdir by rustup, saying addingC:\Users\Administrator\.rustup\toolchains\nightly-2024-10-23-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\libtoPATH.I indeed noticed the
RUSTUP_WINDOWS_PATH_ADD_BINcode and comment in rustup. At that time, I think it just adds a bin dir rather than lib dir, which wouldn't have helped.Update: after scanning
C:\Users\Administrator\.rustup\toolchains\nightly-2024-10-23-x86_64-pc-windows-msvc\binandC:\Users\Administrator\.rustup\toolchains\nightly-2024-10-23-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib, it seems the latter contains more deps dlls which might cause troubles? Can rustup create a dir only containing rust dll libs, and add it toPATH?RUSTUP_WINDOWS_PATH_ADD_BINchange #3825rami3l commentedon Mar 12, 2025
@zjp-CN Thanks for your feedback! Let's continue the discussion over there in the main issue then.
fix(charon CLI): set RUSTUP_WINDOWS_PATH_ADD_BIN=1 on Windows
Nadrieril commentedon Mar 12, 2025
Oh amazing, I didn't expect this variable would work, glad it does.