Skip to content

Commit 92d3739

Browse files
committed
Auto merge of #930 - gnzlbg:fix_musl, r=alexcrichton
Fix --no-default-features builds Closes #928 #929 #684
2 parents bb2a95c + 78320c7 commit 92d3739

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

appveyor.yml

+1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ build: false
2424

2525
test_script:
2626
- cargo test --target %TARGET%
27+
- cargo test --no-default-features --target %TARGET%
2728
- cargo test --manifest-path libc-test/Cargo.toml --target %TARGET%

ci/run.sh

+1
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,5 @@ if [ "$TARGET" = "x86_64-unknown-linux-gnux32" ]; then
7979
opt="--release"
8080
fi
8181

82+
cargo test $opt --no-default-features --manifest-path libc-test/Cargo.toml --target $TARGET
8283
exec cargo test $opt --manifest-path libc-test/Cargo.toml --target $TARGET

libc-test/Cargo.toml

+8-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@ version = "0.1.0"
44
authors = ["Alex Crichton <[email protected]>"]
55
build = "build.rs"
66

7-
[dependencies]
8-
libc = { path = ".." }
7+
[dependencies.libc]
8+
path = ".."
9+
default-features = false
910

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

14+
[features]
15+
default = [ "use_std" ]
16+
use_std = [ "libc/use_std" ]
17+
1318
[[test]]
1419
name = "main"
1520
path = "test/main.rs"
@@ -19,3 +24,4 @@ harness = false
1924
name = "linux-fcntl"
2025
path = "test/linux_fcntl.rs"
2126
harness = false
27+

src/unix/mod.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -277,16 +277,20 @@ cfg_if! {
277277
// cargo build, don't pull in anything extra as the libstd dep
278278
// already pulls in all libs.
279279
} else if #[cfg(target_env = "musl")] {
280-
#[link(name = "c", kind = "static", cfg(target_feature = "crt-static"))]
281-
#[link(name = "c", cfg(not(target_feature = "crt-static")))]
280+
#[cfg_attr(feature = "stdbuild",
281+
link(name = "c", kind = "static",
282+
cfg(target_feature = "crt-static")))]
283+
#[cfg_attr(feature = "stdbuild",
284+
link(name = "c", cfg(not(target_feature = "crt-static"))))]
282285
extern {}
283286
} else if #[cfg(target_os = "emscripten")] {
284287
#[link(name = "c")]
285288
extern {}
286-
} else if #[cfg(all(target_os = "netbsd", target_vendor = "rumprun"))] {
289+
} else if #[cfg(all(target_os = "netbsd"))] {
287290
// Since we don't use -nodefaultlibs on Rumprun, libc is always pulled
288291
// in automatically by the linker. We avoid passing it explicitly, as it
289292
// causes some versions of binutils to crash with an assertion failure.
293+
#[cfg_attr(feature = "stdbuild", target_vendor = "rumprun")]
290294
#[link(name = "m")]
291295
extern {}
292296
} else if #[cfg(any(target_os = "macos",

0 commit comments

Comments
 (0)