-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Description
Problem
Adding an additional crate-type listing appears to affect the size of other crate types, specifically moving from crate-type = ["cdylib", "staticlib"]
--> crate-type = ["cdylib", "staticlib", "rlib"]
appears to increase the size of the "cdylib" output (in this case a Linux .so
ELF) by 100% (2MB -> 4MB) which is suspiciously close to the size of the "rlib" output.
The motivation is to provide benchmarking (via criterion) which of course involves depending on the the core crate to build benchmark functions against. This dependency requires a Rust-style output target, not an arbitrary binary that "cdylib" generates. Adding the "rlib" target does in fact allow the benchmarking but the side-effect of the dramatically increased binary size is not viable, and this size increase appears through the standard cargo build --release
process itself.
Steps
Hard to provide concise steps - but basically add an "rlib" type target for an existing "cdylib" crate that exports an some FFI? If this is a me problem, I'd love to hear how to fix this!
Notes
Output of cargo version
:
cargo 1.30.0 (36d96825d 2018-10-24)
Also - rustc 1.30.0 stable
as the toolchain.