Closed
Description
I gather that prefer-dynamic isn't the preferred mode of compiling, but I use it in Evcxr to try and keep memory usage down when compiling and loading lots of .so files with similar dependencies.
Cargo.toml:
[package]
name = "foo"
version = "1.0.0"
edition = "2018"
[dependencies]
reqwest = "0.11"
tokio = {version = "1.2.0", features = ["full"]}
main.rs:
fn main() {
let _ = tokio::runtime::Runtime::new()
.unwrap()
.block_on(async { reqwest::get("https://www.rust-lang.org") });
}
cargo build
succeeds, however cargo rustc -- -C prefer-dynamic
fails to link with lots of missing symbols. e.g.:
/usr/bin/ld: /home/david/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-channel-0.3.13/src/oneshot.rs:224: undefined reference to `core::mem::drop'
/usr/bin/ld: /home/david/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-channel-0.3.13/src/oneshot.rs:233: undefined reference to `core::ptr::drop_in_place<futures_channel::lock::TryLock<core::option::Option<core::task::wake::Waker>>>'
Meta
Got this behavior on nightly 2021-03-09 as well as stable versions back as far as 1.44. Prior that the code doesn't compile due to missing features.
rustc +nightly --version --verbose
:
rustc 1.52.0-nightly (3a5d45f 2021-03-09)
binary: rustc
commit-hash: 3a5d45f
commit-date: 2021-03-09
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 12.0.0
Original report: evcxr/evcxr#156