I recognise I'm trying something slightly odd here, but it still feels like it should work.
In short, I'm trying to use a combination of using cargo to build a public crate, but then use rustc directly to compile my own code (basically because I'm trying to integrate with an existing build system).
I build a given public crate using cargo, with type dylib - that works fine and produces a .so at target/debug/.
I'm then trying to use that dylib from my own source using rustc directly:
rustc -C prefer-dynamic -L target/debug/ --emit obj -o hello_world.o hello_world.rs
This fails with:
error[E0460]: found possibly newer version of crate unicode_width
If I instead pick up all the cargo dependencies by using a different -L path:
rustc -C prefer-dynamic -L target/debug/deps/ --emit obj -o hello_world.o hello_world.rs
Then I get:
error: cannot satisfy dependencies so std
only shows up once
(repeated with 17 errors for each crate.)
Is there a sensible way to get this to work? Or does what I'm trying to do just not seem viable?