Skip to content
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

Remove duplicate dependencies by patching, and add back links field #40

Merged
merged 1 commit into from
Feb 3, 2022

Conversation

AzureMarker
Copy link
Member

@AzureMarker AzureMarker commented Feb 3, 2022

We don't want duplicate ctru-sys crates in the dependency graph. Same for libc. We can patch them here to avoid any issues.

Now that we don't have duplicate ctru-sys crates, we can add back the links field. This field is important because it warns us when there are two crates linking to the same library (ex. duplicate ctru-sys crates). I think there's some misconceptions about how the links field works, so here's its docs and some clarifications:
https://doc.rust-lang.org/cargo/reference/build-scripts.html#the-links-manifest-key
The links field does not automatically link the crate to the library. Instead it's more of a hint to Cargo that this crate should link to that native library. Cargo then enforces some things, like having a build script and only having one crate which links to this library in the dependency graph. These are useful things to enforce.

Downstream crates don't need the ctru-sys patch, so it's only an issue here (they could add the patch for libc, but it's not required). I verified this with my project: AzureMarker/n3ds-controller@e16453c

We don't want duplicate ctru-sys crates in the dependency graph. Same
for libc. We can patch them here to avoid any issues.

Now that we don't have duplicate ctru-sys crates, we can add back the
links field. This field is important because it warns us when there are
two crates linking to the same library (ex. duplicate ctru-sys crates).
@Meziu Meziu merged commit 2ed36b9 into master Feb 3, 2022
@AzureMarker AzureMarker deleted the fix/duplicate-dependencies branch February 3, 2022 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants