From 9393b838054d53c49d552854aae85a7aa55715ba Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Sun, 23 Jul 2023 12:56:32 +0200 Subject: [PATCH] fix(cli): build script panics on musl due to glibc_version check musl supports dynamic list. This patch comes from https://github.com/12101111/overlay/blob/cb58b125ada1d11c0309da144309628c5670af46/dev-lang/deno/files/glibc.patch. Resolves #17739 Co-Authored-By: 12101111 --- cli/build.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cli/build.rs b/cli/build.rs index 9238096fe92506..a0088c38524c7f 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -437,11 +437,13 @@ fn main() { #[cfg(target_os = "linux")] { - let ver = glibc_version::get_version().unwrap(); - // If a custom compiler is set, the glibc version is not reliable. // Here, we assume that if a custom compiler is used, that it will be modern enough to support a dynamic symbol list. - if env::var("CC").is_err() && ver.major <= 2 && ver.minor < 35 { + if env::var("CC").is_err() + && glibc_version::get_version() + .map(|ver| ver.major <= 2 && ver.minor < 35) + .unwrap_or(false) + { println!("cargo:warning=Compiling with all symbols exported, this will result in a larger binary. Please use glibc 2.35 or later for an optimised build."); println!("cargo:rustc-link-arg-bin=deno=-rdynamic"); } else {