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

native library is being linked to by more than one package - when using replace in Cargo.toml #4186

pgkos opened this Issue Jun 18, 2017 · 2 comments


None yet
3 participants

pgkos commented Jun 18, 2017

I want to test a patch (to gtk-sys crate, using a test project dependent on gtk-rs crate), so I have added a [replace] section to my Cargo.toml with a path to my local patched version of gtk-sys crate:

name = "gtk-sys-patch-test"
version = "0.1.0"

"gtk-sys:0.3.4" = { path = "../gtk-sys-patch/gtk-sys" }

version = "0.1.3"

But I cannot test the patch because when I add the [replace] section I get this error message:

native library `gobject` is being linked to by more than one package, and can only be linked to by one package

  gobject-sys v0.3.4
  gobject-sys v0.3.4 (file:///home/pgkos/gtk-sys-patch/gobject-sys)

Is this a bug or am I doing something wrong?


This comment has been minimized.

mjkillough commented Jun 19, 2017

I don't know if this is a bug, but I bumped into the same thing earlier today. I was trying to replace one of the gtk-rs packages with their master branch in order to get an unpublished fix.

I think the issue is that the gtk-sys's Cargo.toml use path = "../gobject-sys", but somewhere else is trying to depend against the v0.3.4 on I don't know if Cargo could be smart enough to realise that the replaced gtk-sys pulled in a path dependency, which should then be used to fulfil the dependency by any other package that needs it.

I got it to work by using this big [replace] section:

"gtk-sys:0.3.4" = { git = "" }
"glib-sys:0.3.4" = { git ="" }
"gdk-pixbuf-sys:0.3.4" = { git ="" }
"gobject-sys:0.3.4" = { git ="" }
"gio-sys:0.3.4" = { git ="" }
"gdk-sys:0.3.4" = { git ="" }
"cairo-sys-rs:0.3.4" = { git ="" }
"pango-sys:0.3.4" = { git ="" }

This comment has been minimized.


alexcrichton commented Jun 19, 2017

Ah yes I believe this is working as intended as pointed out by @mjkillough. You've replaced gtk-sys which ends up picking up a different version of gobject-sys, meaning there's now two gobject-sys crates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment