本机库`glib`由多个包链接,并且只能通过一个包

时间:2017-05-10 01:48:33

标签: rust

假设这段代码:

extern crate glib;

fn main() { 

当我cargo run时,我收到此错误:

error[E0463]: can't find crate for `glib`
  --> src/main.rs:17:1
   |
17 | extern crate glib;
   | ^^^^^^^^^^^^^^^^^^ can't find crate

我的Cargo.toml看起来像

[dependencies]
gtk = { git = "https://github.com/gtk-rs/gtk" }

[features]
default = ["gtk/v3_10"]

glib没有出现。如果我添加它:

[dependencies]
gtk = { git = "https://github.com/gtk-rs/gtk" }
glib = "0.1.3"

[features]
default = ["gtk/v3_10"]

我收到此错误:

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

如何修复此错误?它是什么意思以及为什么要显示它?

我看过 Cargo.lock ,似乎有name =" glib ",但我不知道如何处理这种情况:

//..
[[package]]
name = "gdk-sys"
version = "0.3.4"
source = "git+https://github.com/gtk-rs/sys#9556f8fe2dd00cfce05614b290a09d683b4b4209"
dependencies = [
 //..
 "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 //..
]

[[package]]
name = "gio"
version = "0.1.3"
source = "git+https://github.com/gtk-rs/gio#c8b2d3bce17dc4bb5562b83a73602ebf09fe201c"
dependencies = [
 //..
 "glib 0.1.3 (git+https://github.com/gtk-rs/glib)",
 "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 //..
]

[[package]]
name = "gio-sys"
version = "0.3.4"
source = "git+https://github.com/gtk-rs/sys#9556f8fe2dd00cfce05614b290a09d683b4b4209"
dependencies = [
 //..
 "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 //..
]

[[package]]
name = "glib"
version = "0.1.3"
source = "git+https://github.com/gtk-rs/glib#65d9f4dc60b6119a5cb9cc8390c8bfc77cd13ef5"
dependencies = [
 "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
]

//..

我不知道你是否提到了我的评论,因为我现在已经收到了charge.toml,而且这是有效的,所以我把它留在这里:

Cargo.toml 这似乎解决了这个问题,但我不知道这是不是正确的方法

[package]
//..

[dependencies]
gtk = { git = "https://github.com/gtk-rs/gtk" }
glib = { git = "https://github.com/gtk-rs/glib" }

[features]
default = ["gtk/v3_10"]

在显示代码段

中的之前的完整Cargo.lock

[root]
name = "test_thread_gtk"
version = "0.1.0"
dependencies = [
 "gtk 0.1.3 (git+https://github.com/gtk-rs/gtk)",
]

[[package]]
name = "atk-sys"
version = "0.3.4"
source = "git+https://github.com/gtk-rs/sys#9556f8fe2dd00cfce05614b290a09d683b4b4209"
dependencies = [
 "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
 "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "bitflags"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "bitflags"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "c_vec"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "cairo-rs"
version = "0.1.3"
source = "git+https://github.com/gtk-rs/cairo#680ccfdb1ea4509d42a0333bd5bd9d43d75db077"
dependencies = [
 "c_vec 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)",
 "glib 0.1.3 (git+https://github.com/gtk-rs/glib)",
 "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
 "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "cairo-sys-rs"
version = "0.3.4"
source = "git+https://github.com/gtk-rs/cairo#680ccfdb1ea4509d42a0333bd5bd9d43d75db077"
dependencies = [
 "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
 "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
 "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "gdk"
version = "0.5.3"
source = "git+https://github.com/gtk-rs/gdk#a585b1f09b0f059f2d6a14862258d374564c1ce3"
dependencies = [
 "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "cairo-rs 0.1.3 (git+https://github.com/gtk-rs/cairo)",
 "cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)",
 "gdk-pixbuf 0.1.3 (git+https://github.com/gtk-rs/gdk-pixbuf)",
 "gdk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "gio 0.1.3 (git+https://github.com/gtk-rs/gio)",
 "glib 0.1.3 (git+https://github.com/gtk-rs/glib)",
 "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
 "pango 0.1.3 (git+https://github.com/gtk-rs/pango)",
]

[[package]]
name = "gdk-pixbuf"
version = "0.1.3"
source = "git+https://github.com/gtk-rs/gdk-pixbuf#09fafcfc515b9866d4aa88b026cc2261bf322350"
dependencies = [
 "gdk-pixbuf-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "glib 0.1.3 (git+https://github.com/gtk-rs/glib)",
 "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "gdk-pixbuf-sys"
version = "0.3.4"
source = "git+https://github.com/gtk-rs/sys#9556f8fe2dd00cfce05614b290a09d683b4b4209"
dependencies = [
 "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
 "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "gdk-sys"
version = "0.3.4"
source = "git+https://github.com/gtk-rs/sys#9556f8fe2dd00cfce05614b290a09d683b4b4209"
dependencies = [
 "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)",
 "gdk-pixbuf-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
 "pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "gio"
version = "0.1.3"
source = "git+https://github.com/gtk-rs/gio#c8b2d3bce17dc4bb5562b83a73602ebf09fe201c"
dependencies = [
 "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "glib 0.1.3 (git+https://github.com/gtk-rs/glib)",
 "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "gio-sys"
version = "0.3.4"
source = "git+https://github.com/gtk-rs/sys#9556f8fe2dd00cfce05614b290a09d683b4b4209"
dependencies = [
 "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
 "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "glib"
version = "0.1.3"
source = "git+https://github.com/gtk-rs/glib#65d9f4dc60b6119a5cb9cc8390c8bfc77cd13ef5"
dependencies = [
 "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "glib-sys"
version = "0.3.4"
source = "git+https://github.com/gtk-rs/sys#9556f8fe2dd00cfce05614b290a09d683b4b4209"
dependencies = [
 "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
 "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "gobject-sys"
version = "0.3.4"
source = "git+https://github.com/gtk-rs/sys#9556f8fe2dd00cfce05614b290a09d683b4b4209"
dependencies = [
 "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
 "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "gtk"
version = "0.1.3"
source = "git+https://github.com/gtk-rs/gtk#25f753392840348645855f60cbd08521043d5926"
dependencies = [
 "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "cairo-rs 0.1.3 (git+https://github.com/gtk-rs/cairo)",
 "cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)",
 "gdk 0.5.3 (git+https://github.com/gtk-rs/gdk)",
 "gdk-pixbuf 0.1.3 (git+https://github.com/gtk-rs/gdk-pixbuf)",
 "gdk-pixbuf-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "gdk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "gio 0.1.3 (git+https://github.com/gtk-rs/gio)",
 "gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "glib 0.1.3 (git+https://github.com/gtk-rs/glib)",
 "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "gtk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
 "pango 0.1.3 (git+https://github.com/gtk-rs/pango)",
]

[[package]]
name = "gtk-sys"
version = "0.3.4"
source = "git+https://github.com/gtk-rs/sys#9556f8fe2dd00cfce05614b290a09d683b4b4209"
dependencies = [
 "atk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)",
 "gdk-pixbuf-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "gdk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
 "pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "lazy_static"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "libc"
version = "0.2.22"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "pango"
version = "0.1.3"
source = "git+https://github.com/gtk-rs/pango#485658b9479671818c8d15877d2078f12c71ec78"
dependencies = [
 "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib 0.1.3 (git+https://github.com/gtk-rs/glib)",
 "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
 "pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
]

[[package]]
name = "pango-sys"
version = "0.3.4"
source = "git+https://github.com/gtk-rs/sys#9556f8fe2dd00cfce05614b290a09d683b4b4209"
dependencies = [
 "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
 "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
 "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "pkg-config"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "winapi"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"

[metadata]
"checksum atk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4f67931368edf3a9a51d29886d245f1c3db2f1ef0dcc9e35ff70341b78c10d23"
"checksum bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1370e9fc2a6ae53aea8b7a5110edbd08836ed87c88736dfabccade1c2b44bff4"
"checksum c_vec 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6237ac5a4b1e81c213c24c6437964c61e646df910a914b4ab1487b46df20bd13"
"checksum cairo-rs 0.1.3 (git+https://github.com/gtk-rs/cairo)" = "<none>"
"checksum cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)" = "<none>"
"checksum gdk 0.5.3 (git+https://github.com/gtk-rs/gdk)" = "<none>"
"checksum gdk-pixbuf 0.1.3 (git+https://github.com/gtk-rs/gdk-pixbuf)" = "<none>"
"checksum gdk-pixbuf-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum gdk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum gio 0.1.3 (git+https://github.com/gtk-rs/gio)" = "<none>"
"checksum gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum glib 0.1.3 (git+https://github.com/gtk-rs/glib)" = "<none>"
"checksum glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum gtk 0.1.3 (git+https://github.com/gtk-rs/gtk)" = "<none>"
"checksum gtk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf"
"checksum libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)" = "babb8281da88cba992fa1f4ddec7d63ed96280a1a53ec9b919fd37b53d71e502"
"checksum pango 0.1.3 (git+https://github.com/gtk-rs/pango)" = "<none>"
"checksum pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"

0 个答案:

没有答案