diff --git a/libc-test/build.rs b/libc-test/build.rs
index a72039f9235e1c7655ca0cae081c4fe0fcc75415..b26b393ec9516c961acf4ae681fb47df71800ab0 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -91,7 +91,7 @@ fn main() {
         cfg.header("sys/mman.h");
         cfg.header("sys/resource.h");
         cfg.header("sys/socket.h");
-        if linux {
+        if linux && !musl {
             cfg.header("linux/if.h");
         }
         cfg.header("sys/time.h");
@@ -665,8 +665,10 @@ fn main() {
         } else {
             cfg.header("linux/fcntl.h");
         }
-        cfg.header("net/if.h");
-        cfg.header("linux/if.h");
+        if !musl {
+            cfg.header("net/if.h");
+            cfg.header("linux/if.h");
+        }
         cfg.header("linux/quota.h");
         cfg.skip_const(move |name| {
             match name {