From bcae73692e50344764f49bedb7712e82a2a450e7 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 7 May 2021 07:37:48 -0700 Subject: [PATCH] Allow android C compile to fail A C compiler hasn't been required historically, so let's assume we don't know the API version if the C compiler fails. Closes #424 --- build.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index abe896dfe..812fbb1fe 100644 --- a/build.rs +++ b/build.rs @@ -10,7 +10,13 @@ fn main() { } fn build_android() { - let expansion = cc::Build::new().file("src/android-api.c").expand(); + let expansion = match cc::Build::new().file("src/android-api.c").try_expand() { + Ok(result) => result, + Err(e) => { + println!("failed to run C compiler: {}", e); + return; + } + }; let expansion = match std::str::from_utf8(&expansion) { Ok(s) => s, Err(_) => return,