Skip to content

Commit 724cf0f

Browse files
committed
More information for links conflicting
1 parent b3475e6 commit 724cf0f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/cargo/core/resolver/errors.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ pub(super) fn activation_error(
129129
msg.push_str(link);
130130
msg.push_str("` as well:\n");
131131
msg.push_str(&describe_path(&cx.parents.path_to_bottom(p)));
132+
msg.push_str("\nOnly one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. ");
133+
msg.push_str("Try to adjust your dependencies so that only one package uses the links ='");
134+
msg.push_str(&*dep.package_name());
135+
msg.push_str("' value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.");
132136
}
133137
ConflictReason::MissingFeatures(features) => {
134138
msg.push_str("\n\nthe package `");

tests/testsuite/build_script.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,7 @@ versions that meet the requirements `*` are: 0.5.0
772772
773773
the package `a-sys` links to the native library `a`, but it conflicts with a previous package which links to `a` as well:
774774
package `foo v0.5.0 ([..])`
775+
Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the links ='a-sys' value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.
775776
776777
failed to select a version for `a-sys` which could resolve this conflict
777778
").run();
@@ -891,6 +892,7 @@ versions that meet the requirements `*` are: 0.5.0
891892
892893
the package `a-sys` links to the native library `a`, but it conflicts with a previous package which links to `a` as well:
893894
package `foo v0.5.0 ([..])`
895+
Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the links ='a-sys' value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.
894896
895897
failed to select a version for `a-sys` which could resolve this conflict
896898
").run();
@@ -4081,6 +4083,7 @@ versions that meet the requirements `*` are: 0.5.0
40814083
40824084
the package `a` links to the native library `a`, but it conflicts with a previous package which links to `a` as well:
40834085
package `foo v0.5.0 ([..])`
4086+
Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the links ='a' value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.
40844087
40854088
failed to select a version for `a` which could resolve this conflict
40864089
").run();

0 commit comments

Comments
 (0)