Closed
Description
Consider a project:
.
├── Cargo.lock
├── Cargo.toml
├── library
│ ├── Cargo.toml
│ └── src
│ └── lib.rs
└── user
├── Cargo.toml
└── src
└── lib.rs
./Cargo.toml
:
[workspace]
members = ["user", "library"]
library/Cargo.toml
:
[package]
name = "library"
version = "0.1.0"
authors = ["Alexander Bulaev <[email protected]>"]
[dependencies]
serde_derive = "*"
library/src/lib.rs
:
extern crate serde_derive;
user/Cargo.toml
:
[package]
name = "user"
version = "0.1.0"
authors = ["Alexander Bulaev <[email protected]>"]
[lib]
crate-type = ["rlib", "dylib"]
[dependencies]
library = { path = "../library" }
serde_derive = "*"
user/src/lib.rs
:
extern crate library;
extern crate serde_derive;
Then:
alexbool@alexbool-osx ~/D/I/r/user> cargo build
Compiling quote v0.3.5
Compiling unicode-xid v0.0.3
Compiling syn v0.10.3
Compiling serde_codegen_internals v0.11.1
Compiling serde_codegen v0.8.18
Compiling serde_derive v0.8.18
Compiling library v0.1.0 (file:///Users/alexbool/Documents/IdeaProjects/rust-fail/library)
warning: custom derive crates and `#[no_link]` crates have no effect without `#[macro_use]`
--> /Users/alexbool/Documents/IdeaProjects/rust-fail/library/src/lib.rs:1:1
|
1 | extern crate serde_derive;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
Compiling user v0.1.0 (file:///Users/alexbool/Documents/IdeaProjects/rust-fail/user)
Finished debug [unoptimized + debuginfo] target(s) in 13.74 secs
alexbool@alexbool-osx ~/D/I/r/user> otool -L ../target/debug/libuser.dylib
../target/debug/libuser.dylib:
/Users/alexbool/Documents/IdeaProjects/rust-fail/target/debug/deps/libuser.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/libstd-1357b93f.dylib (compatibility version 0.0.0, current version 0.0.0)
/Users/alexbool/Documents/IdeaProjects/rust-fail/target/debug/deps/libserde_derive-7dacf7ca26e124d8.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)
Whoa! This artifact depends on libserde_derive-7dacf7ca26e124d8.dylib
and libstd-1357b93f.dylib
.
If you try staticlib, you get an error:
Compiling user v0.1.0 (file:///Users/alexbool/Documents/IdeaProjects/rust-fail/user)
error: dependency `serde_derive` not found in rlib format
error: aborting due to previous error
error: Could not compile `user`.
If you try a binary, it compiles but obviously cannot be run:
alexbool@alexbool-osx ~/D/I/r/user> ../target/debug/user
dyld: Library not loaded: @rpath/libstd-1357b93f.dylib
Referenced from: /Users/alexbool/Documents/IdeaProjects/rust-fail/user/../target/debug/user
Reason: image not found
fish: '../target/debug/user' terminated by signal SIGABRT (Abort)
Meta:
macOS Sierra
alexbool@alexbool-osx ~> rustc -vV
rustc 1.15.0-nightly (ac635aa95 2016-11-18)
binary: rustc
commit-hash: ac635aa95ba851898e125b047ad7b8d6a8fecf8e
commit-date: 2016-11-18
host: x86_64-apple-darwin
release: 1.15.0-nightly
LLVM version: 3.9
alexbool@alexbool-osx ~> cargo --version
cargo 0.16.0-nightly (d1bfc01 2016-11-18)
Also reproduces on Windows i686 msvc.
Metadata
Metadata
Assignees
Labels
No labels