-
Notifications
You must be signed in to change notification settings - Fork 402
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't use output hash in filename for crates of type cdylib #1066
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Looks good, could you please add a test? |
4d323e3
to
0cea26b
Compare
UebelAndre
approved these changes
Dec 16, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit from me but otherwise looks good!
e8f3e71
to
ad14b70
Compare
UebelAndre
requested changes
Dec 17, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to flip-flop 馃槄 I noticed two things before merging
2f8da87
to
30050be
Compare
UebelAndre
requested changes
Dec 17, 2021
30050be
to
1aeb6e5
Compare
1aeb6e5
to
7931343
Compare
UebelAndre
approved these changes
Dec 20, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cdylib crates, similarly to binaries, are meant for consumption outside of the rust ecosystem. For this reason, there is no need to attempt making their name unique to disambiguate them from other crates with the same name but different features/versions in the Rust/Cargo dependency graph (as discussed in #405).
In fact, when distributing dynamic libraries or embedding them into applications, it is critical for their name to be deterministic since it ends up embedded into the executable itself, that the linker uses to link/resolve the library. On macOS, this requires the use of
install_name_tool
to tweak the id/name after it's build. On Windows, one has to re-generate the LIB file to embed the new name (which afaict can only be done via the hacky intermediary export to a DEF file) and live with the fact that the associated pdb will embed the previous library name.This patch just doesn't use the hash for cdylib library crates. It solves the problem above and all tests still pass so I assume it's not breaking anything crucial that was depending on this before 馃槂