-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Output filename collision with dylib on windows release mode #8794
Comments
Thanks for the report! Can you say more about why you are using a dylib with a build dependency? The reason for the collision is that A workaround is to use the The error message could definitely be better in this case. And ideally it wouldn't happen at all, but there are constraints for naming DLLs on windows that make it difficult. I think something like #6668 would probably be a lead towards fixing this (or maybe making it much worse, I forget!). In general, shared library naming causes a fair bit of trouble, so it is difficult to manage. |
Ah right! I was wondering why it was being built twice, that makes sense. Hopefully the use case will be more clear tomorrow, we're planning on open-sourcing the project super soon, but yeah. Long story short, the build script references the dylib as a convenience for users building the project. Specifically, the dylib is not required directly by the build script, but rather a tool the build script invokes, which dlopens (or the corresponding platform-specific thing) the dylib. It is not required for a normal dependency - I'm kind of surprised build deps are automatically normal deps, is there a way to disable that? It's a little complex, due to the fact that build.rs merely references a helper crate, and the helper crate is the one that references the dylib (and has all the code for invoking the tool, etc.). As for why it's a cargo reference, we'd like to make the install process as clean and smooth as possible, so we'd like to avoid requiring people to pre-install the dylib before using anything that happens to (transitively) reference something that needs it in the build script. The first solution was to literally call |
When you run |
Ah thanks! And for context, because it's opensource now as of a few hours ago, the project is rust-gpu. "The dylib" is rustc_codegen_spirv, the rustc backend. "The tool that dlopens the dylib" is rustc (invoked by a nested cargo). "The helper crate that references the dylib" is the spirv-builder crate. The whole convoluted setup is for users, in their |
This repro case looks really convoluted, my apologies, but, it has a (sort of sane) full use case. Linking #6313 because it's referenced in the output log. I'm not sure if this is a rustc bug or a cargo bug, but it feels like a cargo bug, so I'm filing it here - feel free to tell me to file it on the rust repo.
Here's contents of the whole project for the repro:
./Cargo.toml
./thedylib/Cargo.toml
./thedylib/src/lib.rs
./dylibtest/Cargo.toml
./dylibtest/build.rs
./dylibtest/src/main.rs
On windows:
cargo build
succeeds without error. (what?? why does debug succeed but release fail??)cargo build --release
fails:Click to expand large amount of output
I'm not too sure what's going on here, but it's really weird. I believe both debug and release work on linux, but I'm not 100% sure.
Output of
cargo version
:cargo 1.47.0 (f3c7e066a 2020-08-28)
The text was updated successfully, but these errors were encountered: