跳至内容

默默道来

Docker使用笔记 - 1

Alpine Linux 的 /sbin/ldconfig 和其他发行版不同,摘录如下:

https://git.alpinelinux.org/aports/blame/main/musl/ldconfig?h=3.10-stable

ldconfig is used by some packages’ install script to create the SONAME symlinks in the DESTDIR. do those symlinks for non-system directories.

#!/bin/sh
scan_dirs() {
    scanelf -qS "$@" | while read SONAME FILE; do
        TARGET="${FILE##*/}"
        LINK="${FILE%/*}/$SONAME"
        case "$FILE" in
        /lib/*|/usr/lib/*|/usr/local/lib/*) ;;
        *) [ -h "$LINK" -o ! -e "$LINK" ] && ln -sf "$TARGET" "$LINK"
        esac
    done
    return 0
}
# eat ldconfig options
while getopts "nNvXvf:C:r:" opt; do
    :
done
shift $(( $OPTIND - 1 ))
[ $# -gt 0 ] && scan_dirs "$@"

这可能会带来一些失败,对不是强依赖的,可以手动指定 LIBPATH=/usr/lib INCPATH=/usr/include.