I am trying to modify Racer to generate a shared library instead of rlib.
To do this, I added crate-type = ["dylib"] to the [lib] section of the Cargo manifest, and then launched cargo build --lib . This worked fine, and libracer.so was emitted.
Unfortunately, now I could not create the Racer binary, which depends on the static version of the library. Running cargo build complains:
Compiling racer v1.0.0 (file:///home/georgev/dotfiles/vim/bundle/racer) error: cannot satisfy dependencies so `std` only shows up once help: having upstream crates all available in one format will likely make this go away error: cannot satisfy dependencies so `core` only shows up once help: having upstream crates all available in one format will likely make this go away error: cannot satisfy dependencies so `collections` only shows up once help: having upstream crates all available in one format will likely make this go away error: cannot satisfy dependencies so `rustc_unicode` only shows up once help: having upstream crates all available in one format will likely make this go away error: cannot satisfy dependencies so `alloc` only shows up once help: having upstream crates all available in one format will likely make this go away error: cannot satisfy dependencies so `libc` only shows up once help: having upstream crates all available in one format will likely make this go away error: cannot satisfy dependencies so `rand` only shows up once help: having upstream crates all available in one format will likely make this go away error: aborting due to 7 previous errors Could not compile `racer`.
I changed crate-type to ["dylib", "bin"] , which allowed the compilation to succeed. However, cargo build --lib will no longer generate a shared library (rlib only).
How can I indicate which type of library I would like to build while maintaining a static library for inclusion in the executable?
source share