Skip to content

Commit

Permalink
[SOL] Detect the target triple on Linux systems with musl
Browse files Browse the repository at this point in the history
  • Loading branch information
vadorovsky committed May 15, 2024
1 parent 696ef74 commit 061acfa
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,20 @@ fi

unameOut="$(uname -s)-$(uname -m)"
case "${unameOut}" in
Linux-x86_64*) HOST_TRIPLE=x86_64-unknown-linux-gnu;;
Linux-aarch64*) HOST_TRIPLE=aarch64-unknown-linux-gnu;;
Linux*)
LDD_VERSION=$(ldd --version 2>&1 | head -n 1 | tr '[:upper:]' '[:lower:]')
if [[ "${LDD_VERSION}" == *"glibc"* ]]; then
LIBC_SUFFIX="gnu"
elif [[ "${LDD_VERSION}" == *"musl"* ]]; then
LIBC_SUFFIX="musl"
else

if [[ "$(uname -m)" == "arm64" ]] || [[ "$(uname -m)" == "aarch64" ]]; then
HOST_TRIPLE="aarch64-unknown-linux-${LIBC_SUFFIX}"
else
HOST_TRIPLE="x86_64-unknown-linux-${LIBC_SUFFIX}"
fi
;;
Darwin-x86_64*) HOST_TRIPLE=x86_64-apple-darwin;;
Darwin-arm64*) HOST_TRIPLE=aarch64-apple-darwin;;
MINGW*) HOST_TRIPLE=x86_64-pc-windows-msvc;;
Expand Down

0 comments on commit 061acfa

Please sign in to comment.