I have problems with using cargo to build a lib that depends on libcore in both native and cross build mode. I had to wrap libcore into a package with this:
[package]
name = "zinc-core"
version = "0.0.1"
authors = ["Vladimir Pouzanov <farcaller@gmail.com>"]
[lib]
name = "core"
path = "libcore/lib.rs"
crate-type = ["rlib"]
Which seems to build fine for my target lib:
[package]
name = "zinc-platform-lpc111x"
version = "0.0.1"
authors = ["Vladimir Pouzanov <farcaller@gmail.com>"]
[lib]
name = "lpc111x"
path = "lib.rs"
doc = true
crate-type = ["rlib"]
[dependencies.zinc-volatile_cell]
path = "../../volatile_cell"
[dependencies.zinc-ioreg]
path = "../../ioreg"
[dependencies.zinc-core]
path = "../../../thirdparty"
It compiles in both native and cross setups. However I have problems running cargo test
:
% cargo \test --verbose
Compiling zinc-platform-lpc111x v0.0.1 (file:///Users/farcaller/src/minizinc/src/platform/lpc111x)
Running `rustc lib.rs --crate-name lpc111x --crate-type rlib -g --test -C metadata=b861f46ebfbcb662 -C extra-filename=-b861f46ebfbcb662 --out-dir /Users/farcaller/src/minizinc/src/platform/lpc111x/target --emit=dep-info,link -L dependency=/Users/farcaller/src/minizinc/src/platform/lpc111x/target -L dependency=/Users/farcaller/src/minizinc/src/platform/lpc111x/target/deps --extern ioreg=/Users/farcaller/src/minizinc/src/platform/lpc111x/target/deps/libioreg-44334ee1778c6027.dylib --extern volatile_cell=/Users/farcaller/src/minizinc/src/platform/lpc111x/target/deps/libvolatile_cell-7b16f10c8765a75f.rlib --extern core=/Users/farcaller/src/minizinc/src/platform/lpc111x/target/deps/libcore-e9140f8c69a01782.rlib`
lib.rs:1:1: 1:1 error: duplicate entry for `send` [E0152]
lib.rs:1 #![feature(plugin, core, unsafe_destructor, no_std)]
^
lib.rs:1:1: 1:1 error: duplicate entry for `sized` [E0152]
lib.rs:1 #![feature(plugin, core, unsafe_destructor, no_std)]
^
...
which looks like libcore getting sourced twice. Any ideas?