-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
rustc 1.82.0 doesn't add LIBPATH when invoking link.exe #132016
Comments
cc @petrochenkov, I believe there were some changes to linking with msvc? |
Adding this build script helps, but I think this should only be considered a workaround and rustc should emit library search path by default. println!("cargo:rustc-link-search=native={}/deps", out_dir.display()); |
I don't think this was supposed to work out of the box. Either you should make my_lib a cdylib (requiring you to build the cdylib from within the build script rather than specifying it as dependency, at least until artifact dependencies are stable) and link it like a C library (which includes adding it to the linker search path from a build script) or you should link it like a regular rust library and avoid |
This is likely from #128370. |
Hi @bjorn3 , thanks for the input. I have a few follow up questions:
|
If you want to use it as regular dependency you should make it a dylib.
You probably want to forward the build profile. Also make sure to set By the way what do you want to achieve in the end for which you see dylibs as solution? |
|
You can call into the system allocator from mylib using |
Rust-to-rust dynamic linking (through import library) on Windows fails with toolchain version 1.82.0.
The build log shows that 1.82.0 is not adding any /LIBPATH arguments when invoking link.exe.
I tried this code: nandin-borjigin/rustc-1.82.0-repro
I expected to see this happen: Successful build
Instead, this happened: LINK : fatal error LNK1181: cannot open input file 'mylib.dll.lib'
Meta
rustc --version --verbose
:Backtrace
Possibly related
-Clink-args=resources.res
fails in 1.82 #131995The text was updated successfully, but these errors were encountered: