Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find libc.so directly in musl systems #856

Merged
merged 5 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions constructor/header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@ 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there should be another conditional here in case libc_so is still empty after this to error out or emit a warning.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

system_glibc_version=$("${libc_so}" --version | awk 'NR==1{ sub(/\.$/, ""); print $NF}')
;;
*)
# 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>
Loading