From 90524934a3d3387d2edded385e6b27ccfec4e0bb Mon Sep 17 00:00:00 2001 From: GithubAnon0000 <160563432+GithubAnon0000@users.noreply.github.com> Date: Thu, 1 Jan 2026 02:41:44 +0100 Subject: [PATCH] FEAT(launcher): Add glibc version check on linux --- qt/launcher/lin/install.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/qt/launcher/lin/install.sh b/qt/launcher/lin/install.sh index c9f129654..065de901b 100755 --- a/qt/launcher/lin/install.sh +++ b/qt/launcher/lin/install.sh @@ -7,6 +7,21 @@ if [ "$(dirname "$(realpath "$0")")" != "$(realpath "$PWD")" ]; then exit 1 fi +MINIMUM_REQUIRED_GLIBC_VERSION=2.36 +# `ldd --version` returns the version of glibc, such as 2.41 with other text. +# `grep --only-matching "[0-9]\+.[0-9]\+"` returns the (version) numbers. +# `head --lines=1` only returns the first number (which is the glibc version) +users_glibc_version=$(ldd --version | grep --only-matching "[0-9]\+.[0-9]\+" | head --lines=1) + +# check if the users glibc is less than the required glibc and abort if true. +# bash doesn't do floating point comparisons. But integer comparisons do work. +# Thus, `$(echo $variable | sed "s/\.//")` is used to get an integer +# representation of the floating point number (2.36 becomes 236). +if [ $(echo $users_glibc_version | sed "s/\.//") -lt $(echo $MINIMUM_REQUIRED_GLIBC_VERSION | sed "s/\.//") ]; then + echo "Error: Your glibc version is $users_glibc_version but $MINIMUM_REQUIRED_GLIBC_VERSION is required. Aborting." + exit 1 +fi + if [ "$PREFIX" = "" ]; then PREFIX=/usr/local fi