Skip to content

Commit

Permalink
restore CONDA_OVERRIDE_GLIBC check
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp committed Nov 12, 2024
1 parent 41e216e commit f7bcd15
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions constructor/header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,29 @@ fi
{%- elif linux and min_glibc_version %}
min_glibc_version="{{ min_glibc_version }}"
system_glibc_version="${CONDA_OVERRIDE_GLIBC:-}"
case "$(ldd --version 2>&1)" in
*musl*)
# musl ldd will report musl version; call libc.so directly
# see https://github.com/conda/constructor/issues/850#issuecomment-2343756454
libc_so="$(find /lib /usr/local/lib /usr/lib -name 'libc.so.*' -print -quit 2>/dev/null)"
if [ -z "${libc_so}" ]; then
libc_so="$(strings /etc/ld.so.cache | grep '^/.*/libc\.so.*' | head -1)"
fi
if [ -z "${libc_so}" ]; then
echo "Warning: Couldn't find libc.so; won't be able to determine GLIBC version!" >&2
echo "Override by setting CONDA_OVERRIDE_GLIBC" >&2
system_glibc_version="0.0"
else
system_glibc_version=$("${libc_so}" --version | awk 'NR==1{ sub(/\.$/, ""); print $NF}')
fi
;;
*)
# ldd reports glibc in the last field of the first line
system_glibc_version=$(ldd --version | awk 'NR==1{print $NF}')
;;
esac
if [ "${system_glibc_version}" = "" ]; then
case "$(ldd --version 2>&1)" in
*musl*)
# musl ldd will report musl version; call libc.so directly
# see https://github.com/conda/constructor/issues/850#issuecomment-2343756454
libc_so="$(find /lib /usr/local/lib /usr/lib -name 'libc.so.*' -print -quit 2>/dev/null)"
if [ -z "${libc_so}" ]; then
libc_so="$(strings /etc/ld.so.cache | grep '^/.*/libc\.so.*' | head -1)"
fi
if [ -z "${libc_so}" ]; then
echo "Warning: Couldn't find libc.so; won't be able to determine GLIBC version!" >&2
echo "Override by setting CONDA_OVERRIDE_GLIBC" >&2
system_glibc_version="0.0"
else
system_glibc_version=$("${libc_so}" --version | awk 'NR==1{ sub(/\.$/, ""); print $NF}')
fi
;;
*)
# ldd reports glibc in the last field of the first line
system_glibc_version=$(ldd --version | awk 'NR==1{print $NF}')
;;
esac
fi
# shellcheck disable=SC2183 disable=SC2046
int_min_glibc_version="$(printf "%02d%02d%02d" $(echo "$min_glibc_version" | sed 's/\./ /g'))"
# shellcheck disable=SC2183 disable=SC2046
Expand Down

0 comments on commit f7bcd15

Please sign in to comment.