-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"LoadLibraryExW failed" when loading proc macros with too many -L search paths #110889
Comments
OK, I see that the PATH extension happens intentionally here: rust/compiler/rustc_interface/src/passes.rs Lines 195 to 225 in 8b8110e
It's not clear to me when exactly this is necessary or if there's something smarter that could be done to reduce which paths actually get added to %PATH%, as most dependency search paths in practice are not relevant (e.g. are only for plain rlibs). |
include source error for LoadLibraryExW In rust-lang#107595, we added retry behavior for LoadLibraryExW on Windows. If it fails we do not print the underlying error that Windows returned. This made rust-lang#110889 a little harder to debug. In this PR I am adding the source error in the message if it is available.
include source error for LoadLibraryExW In rust-lang#107595, we added retry behavior for LoadLibraryExW on Windows. If it fails we do not print the underlying error that Windows returned. This made rust-lang#110889 a little harder to debug. In this PR I am adding the source error in the message if it is available.
On Windows, when the total length of
-L
search paths exceeds about 32k characters,rustc
fails to load proc macro DLLs with the message:WinDbg suggests that the error returned is
I noticed that the search paths get added to the
PATH
environment variable (not sure where), but environment variables have a limit of 32,767 characters. So my guess is that an overly full environment causes LoadLibraryExW to fail.Repro gist: https://gist.github.com/goffrie/4fd3553a5417fda17d78e0f8a7252335
Run the commands in repro.ps1. Basically we just need an argfile to run rustc with a very long list of search paths, and then importing proc-macros fails.
This scenario is not likely when using Cargo, but rules_rust for Bazel generates one
-L
per transitive crate dependency which makes this not super difficult to hit.Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: