Skip to content

Commit 334abbc

Browse files
committed
Auto merge of #793 - clarcharr:master, r=alexcrichton
Attempt to fix musl build. Follow-up to #685 and #700.
2 parents c6d4aa6 + 59904c6 commit 334abbc

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
target
22
Cargo.lock
33
*~
4+
/style

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ services:
77
install:
88
- if [ -z "$NO_ADD" ]; then rustup target add $TARGET; fi
99
script:
10-
- cargo build
11-
- cargo build --no-default-features
10+
- cargo build --target=$TARGET
11+
- cargo build --no-default-features --target=$TARGET
1212
- cargo generate-lockfile --manifest-path libc-test/Cargo.toml
1313
- if [[ $TRAVIS_OS_NAME = "linux" ]]; then
1414
sh ci/run-docker.sh $TARGET;

src/unix/mod.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,18 @@ cfg_if! {
242242
// cargo build, don't pull in anything extra as the libstd dep
243243
// already pulls in all libs.
244244
} else if #[cfg(any(all(target_env = "musl", not(target_arch = "mips"))))] {
245-
#[link(name = "c", kind = "static", cfg(target_feature = "crt-static"))]
246-
#[link(name = "c", cfg(not(target_feature = "crt-static")))]
245+
#[cfg_attr(stdbuild,
246+
link(name = "c", kind = "static",
247+
cfg(target_feature = "crt-static")))]
248+
#[cfg_attr(stdbuild,
249+
link(name = "c",
250+
cfg(not(target_feature = "crt-static"))))]
247251
extern {}
248252
} else if #[cfg(target_os = "emscripten")] {
249253
#[link(name = "c")]
250254
extern {}
251-
} else if #[cfg(all(target_os = "netbsd", target_vendor = "rumprun"))] {
255+
} else if #[cfg(all(stdbuild,
256+
target_os = "netbsd", target_vendor = "rumprun"))] {
252257
// Since we don't use -nodefaultlibs on Rumprun, libc is always pulled
253258
// in automatically by the linker. We avoid passing it explicitly, as it
254259
// causes some versions of binutils to crash with an assertion failure.

src/windows.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,10 @@ pub const STRUNCATE: ::c_int = 80;
160160

161161
// inline comment below appeases style checker
162162
#[cfg(all(target_env = "msvc", feature = "stdbuild"))] // " if "
163-
#[link(name = "msvcrt", cfg(not(target_feature = "crt-static")))]
164-
#[link(name = "libcmt", cfg(target_feature = "crt-static"))]
163+
#[cfg_attr(stdbuild,
164+
link(name = "msvcrt", cfg(not(target_feature = "crt-static"))))]
165+
#[cfg_attr(stdbuild,
166+
link(name = "libcmt", cfg(target_feature = "crt-static")))]
165167
extern {}
166168

167169
extern {

0 commit comments

Comments
 (0)