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

Closed
pgkos opened this Issue Jun 18, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@pgkos

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:

[package]
name = "gtk-sys-patch-test"
version = "0.1.0"

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

[dependencies.gtk]
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?

@mjkillough

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 crates.io? 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:

[replace]
"gtk-sys:0.3.4" = { git = "https://github.com/gtk-rs/sys" }
"glib-sys:0.3.4" = { git =" https://github.com/gtk-rs/sys" }
"gdk-pixbuf-sys:0.3.4" = { git =" https://github.com/gtk-rs/sys" }
"gobject-sys:0.3.4" = { git =" https://github.com/gtk-rs/sys" }
"gio-sys:0.3.4" = { git =" https://github.com/gtk-rs/sys" }
"gdk-sys:0.3.4" = { git =" https://github.com/gtk-rs/sys" }
"cairo-sys-rs:0.3.4" = { git =" https://github.com/gtk-rs/cairo" }
"pango-sys:0.3.4" = { git =" https://github.com/gtk-rs/sys" }
@alexcrichton

This comment has been minimized.

Member

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