diff --git a/plugins/pyenv-binary/libexec/pyenv-binary-save b/plugins/pyenv-binary/libexec/pyenv-binary-save index 16019c71..8e2405b2 100755 --- a/plugins/pyenv-binary/libexec/pyenv-binary-save +++ b/plugins/pyenv-binary/libexec/pyenv-binary-save @@ -115,8 +115,12 @@ system_deps() { otool -L "$f" 2>/dev/null | tail -n +2 | awk -v pfx="${prefix}/" \ '$1 !~ /^@/ && substr($1, 1, length(pfx)) != pfx { print $1 }' else + # GNU binutils 2.44 writes "(NEEDED) ... [name]"; FreeBSD 15.1 writes + # "NEEDED ... [name]". readelf(1) documents -d, not its text format. needed="$(LC_ALL=C readelf -dW "$f" 2>/dev/null | awk \ '$2 == "(NEEDED)" || $2 == "NEEDED" { sub(/^.*\[/, ""); sub(/\].*$/, ""); print }' | tr '\n' ' ')" + # Linux and FreeBSD ldd write resolved libraries as + # "name => /absolute/path (address)"; entries without "=>" are ignored. LC_ALL=C ldd "$f" 2>/dev/null | awk -v needed="$needed" -v pfx="${prefix}/" ' BEGIN { split(needed, deps, " ")