]> git.lizzy.rs Git - rust.git/commitdiff
When building libc crate with musl, don't look for libc.a
authorAidan Hobson Sayers <aidanhs@cantab.net>
Sun, 14 Jun 2015 22:55:01 +0000 (23:55 +0100)
committerAidan Hobson Sayers <aidanhs@cantab.net>
Mon, 15 Jun 2015 12:42:18 +0000 (13:42 +0100)
musl may not be available on the target user's machine, and even if
it is, we may not be able to find it because of how static libraries
are searched for.
Instead, use the transitively included liblibc which includes libc.a.

src/liblibc/lib.rs

index b7a40a3f9cf13ba5f2d4a1025e5207afa53982bc..2676d4879b5e397f93b5b778ca4e79246f80cf65 100644 (file)
 #[link(name = "m")]
 extern {}
 
-#[cfg(all(target_env = "musl", not(test)))]
+// When compiling rust with musl, statically include libc.a in liblibc.rlib.
+// A cargo build of the libc crate will therefore automatically pick up the
+// libc.a symbols because liblibc is transitively linked to by the stdlib.
+#[cfg(all(target_env = "musl", not(feature = "cargo-build"), not(test)))]
 #[link(name = "c", kind = "static")]
 extern {}