.rpath(root_profile.get_rpath())
}
- if profile.is_for_host() {
+ let prefer_dynamic = profile.is_for_host() ||
+ (crate_types.contains(&"dylib") &&
+ pkg.get_package_id() != cx.resolve.root());
+ if prefer_dynamic {
cmd = cmd.arg("-C").arg("prefer-dynamic");
}
execs().with_status(0).with_stdout(format!("\
{compiling} foo v0.0.0 ({url})
{running} `rustc {dir}{sep}foo{sep}src{sep}lib.rs --crate-name foo \
- --crate-type dylib --crate-type rlib \
+ --crate-type dylib --crate-type rlib -C prefer-dynamic \
--opt-level 3 \
--cfg ndebug \
-C metadata=[..] \
execs().with_status(0).with_stdout(format!("\
{compiling} foo v0.0.0 ({url})
{running} `rustc {dir}{sep}foo{sep}src{sep}lib.rs --crate-name foo \
- --crate-type dylib --crate-type rlib \
+ --crate-type dylib --crate-type rlib -C prefer-dynamic \
--opt-level 1 \
-g \
-C metadata=[..] \