-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
cdylib on Windows MSVC places .lib import library only under target/*/deps
while the associated .dll is placed in both deps
and its parent directory
#4500
Comments
Memo During a build,
|
Yeah this is an unfortunate case where neither rustc nor Cargo knows about this file. The artifacts are generated directly into the |
@alexcrichton Thanks for your reply. I just read your comment on a similar issue #4535. I will work on a PR to do this in Cargo for Windows MSVC target (when I have some spare time).
|
Memo
Cargo collects the target file name (e.g.
This is done by |
OK. I will implement it in Cargo for now. |
Fixes rust-lang#4500, rust-lang#4535 Until now, Cargo does not have any knowledge about target-specific output files. It relies solely on rustc for this sort of information (`rustc --print=file-names ...`). As a result, Cargo does not place some build artifacts (files) to target/{debug,release} directory. These files include *.wasm for wasm32-unknown-emscripten target and *.dll.lib for *-pc-windows-msvc cdylib target. This commit will add such knowledge to Cargo so that *.wasm and *.dll.lib will be placed in target/{debug,release} directory.
@tatsuya6502 yeah I was thinking we could solve this as well as with the wasm case, thanks for the PR! I'll try to take a look at the PR soon |
…ichton Handle target specific outputs such as .wasm or .dll.lib Fixes #4500, #4535 Until now, Cargo does not have any knowledge about target-specific output files. It relies solely on rustc for this sort of information (`rustc --print=file-names ...`). As a result, Cargo does not place some build artifacts (files) to target/{debug,release} directory. These files include *.wasm for wasm32-unknown-emscripten target and *.dll.lib for *-pc-windows-msvc cdylib target. This commit will add such knowledge to Cargo so that *.wasm and *.dll.lib will be placed in target/{debug,release} directory. **EDIT**: I added [a summary of changes](#4570 (comment)). Please read it for more details of changes. **IMPORTANT** Although I added test cases for both wasm32-unknown-emscripten and *-pc-windows-msvc cdylib targets, ~I did not do manual testing on wasm32-unknown-emscripten target as I do not have an environment with emscripten installed. It will be appreciated if anybody tests this change for wasm32-unknown-emscripten target.~ **EDIT**: Tested for both wasm32-unknown-emscripten and x86_64-pc-windows-msvc. Thanks @Herschel for the help.
On all Windows MSVC, Linux and macOS, cdylib places the dynamic library (such as
.dll
) under./target/{debug,release}/
. However, on Windows MSVC, the associated.lib
import library is not placed in there, but in./target/{debug,release}/deps/
.Is there any reason Cargo puts the
.lib
underdeps
? The.lib
file is required by MSVC C/C++ compiler (cl.exe
) when linking a C program against the.dll
. It would make more sense if the.lib
is placed under./target{debt,release}/
together with.dll
.The text was updated successfully, but these errors were encountered: