Skip to content

Commit

Permalink
Find libc.so directly in musl systems (#856)
Browse files Browse the repository at this point in the history
* Find libc.so directly in musl systems

* add news

* pre-commit

* add ref

Co-authored-by: drewgilliam <[email protected]>

* warn if libc.so can't be found

---------

Co-authored-by: drewgilliam <[email protected]>
  • Loading branch information
jaimergp and drewgilliam authored Sep 13, 2024
1 parent ba00524 commit f4b3bfd
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
15 changes: 13 additions & 2 deletions constructor/header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,19 @@ fi
min_glibc_version="__MIN_GLIBC_VERSION__"
case "$(ldd --version 2>&1)" in
*musl*)
# musl ldd will report musl version; call ld.so directly
system_glibc_version=$($(find /lib/ /lib64/ -name 'ld-linux-*.so*' 2>/dev/null | head -1) --version | awk 'NR==1{ sub(/\.$/, ""); print $NF}')
# 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="${CONDA_OVERRIDE_GLIBC:-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
Expand Down
19 changes: 19 additions & 0 deletions news/856-fix-musl-glibc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* Fix GLIBC detection method in some MUSL systems. (#850 via #856)

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>

0 comments on commit f4b3bfd

Please sign in to comment.