Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't link build scripts dynamically #1960

Merged
merged 1 commit into from
Sep 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cargo/ops/cargo_rustc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ fn build_base_args(cx: &Context,
cmd.arg("--crate-type").arg(crate_type);
}

let prefer_dynamic = target.for_host() ||
let prefer_dynamic = (target.for_host() && !target.is_custom_build()) ||
(crate_types.contains(&"dylib") &&
pkg.package_id() != cx.resolve.root());
if prefer_dynamic {
Expand Down
3 changes: 2 additions & 1 deletion tests/test_cargo_compile_custom_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ test!(build_cmd_with_a_build_cmd {
-L [..]target[..]deps -L [..]target[..]deps`
{compiling} foo v0.5.0 (file://[..])
{running} `rustc build.rs --crate-name build_script_build --crate-type bin \
-C prefer-dynamic -g \
-g \
--out-dir [..]build[..]foo-[..] --emit=dep-info,link \
-L [..]target[..]debug -L [..]target[..]deps \
--extern a=[..]liba-[..].rlib`
Expand Down Expand Up @@ -1109,6 +1109,7 @@ test!(build_script_with_dynamic_native_dependency {
[lib]
name = "builder"
crate-type = ["dylib"]
plugin = true
"#)
.file("src/lib.rs", r#"
#[no_mangle]
Expand Down