diff --git a/src/librustc_data_structures/flock.rs b/src/librustc_data_structures/flock.rs
index 33d71ba862643..26417e3ba7cd1 100644
--- a/src/librustc_data_structures/flock.rs
+++ b/src/librustc_data_structures/flock.rs
@@ -27,7 +27,7 @@ mod imp {
     use std::io;
     use libc;
 
-    #[cfg(target_os = "linux")]
+    #[cfg(any(target_os = "linux", target_os = "android"))]
     mod os {
         use libc;