Skip to content

Commit

Permalink
Auto merge of #930 - gnzlbg:fix_musl, r=alexcrichton
Browse files Browse the repository at this point in the history
Fix --no-default-features builds

Closes #928 #929 #684
  • Loading branch information
bors committed Feb 28, 2018
2 parents bb2a95c + 78320c7 commit 92d3739
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ build: false

test_script:
- cargo test --target %TARGET%
- cargo test --no-default-features --target %TARGET%
- cargo test --manifest-path libc-test/Cargo.toml --target %TARGET%
1 change: 1 addition & 0 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,5 @@ if [ "$TARGET" = "x86_64-unknown-linux-gnux32" ]; then
opt="--release"
fi

cargo test $opt --no-default-features --manifest-path libc-test/Cargo.toml --target $TARGET
exec cargo test $opt --manifest-path libc-test/Cargo.toml --target $TARGET
10 changes: 8 additions & 2 deletions libc-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ version = "0.1.0"
authors = ["Alex Crichton <alex@alexcrichton.com>"]
build = "build.rs"

[dependencies]
libc = { path = ".." }
[dependencies.libc]
path = ".."
default-features = false

[build-dependencies]
ctest = { git = "https://github.com/alexcrichton/ctest" }

[features]
default = [ "use_std" ]
use_std = [ "libc/use_std" ]

[[test]]
name = "main"
path = "test/main.rs"
Expand All @@ -19,3 +24,4 @@ harness = false
name = "linux-fcntl"
path = "test/linux_fcntl.rs"
harness = false

10 changes: 7 additions & 3 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,16 +277,20 @@ cfg_if! {
// cargo build, don't pull in anything extra as the libstd dep
// already pulls in all libs.
} else if #[cfg(target_env = "musl")] {
#[link(name = "c", kind = "static", cfg(target_feature = "crt-static"))]
#[link(name = "c", cfg(not(target_feature = "crt-static")))]
#[cfg_attr(feature = "stdbuild",
link(name = "c", kind = "static",
cfg(target_feature = "crt-static")))]
#[cfg_attr(feature = "stdbuild",
link(name = "c", cfg(not(target_feature = "crt-static"))))]
extern {}
} else if #[cfg(target_os = "emscripten")] {
#[link(name = "c")]
extern {}
} else if #[cfg(all(target_os = "netbsd", target_vendor = "rumprun"))] {
} else if #[cfg(all(target_os = "netbsd"))] {
// Since we don't use -nodefaultlibs on Rumprun, libc is always pulled
// in automatically by the linker. We avoid passing it explicitly, as it
// causes some versions of binutils to crash with an assertion failure.
#[cfg_attr(feature = "stdbuild", target_vendor = "rumprun")]
#[link(name = "m")]
extern {}
} else if #[cfg(any(target_os = "macos",
Expand Down

0 comments on commit 92d3739

Please sign in to comment.