From ef946b42825cdd4da06ef2fff6791c4dbdd3c4cf Mon Sep 17 00:00:00 2001 From: ChatGPT Date: Sat, 13 Jun 2026 00:00:00 +0000 Subject: [PATCH] build: detect system libpam in prepare-local-deps prepare-local-deps.sh only stages PAM headers and expects final linking against the host libpam. Some distributions/containers do not provide the unversioned /usr/lib/libpam.so development symlink, but do provide the runtime soname such as /lib/x86_64-linux-gnu/libpam.so.0. Detect the host libpam path when printing the CMake hints so the generated command can be used directly in those environments. --- prepare-local-deps.sh | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/prepare-local-deps.sh b/prepare-local-deps.sh index 545e8c9..5d50d1e 100755 --- a/prepare-local-deps.sh +++ b/prepare-local-deps.sh @@ -24,6 +24,18 @@ find_one() { printf '%s\n' "$1" } +find_system_lib() { + soname=$1 + for dir in /lib /usr/lib /lib/* /usr/lib/* /usr/local/lib; do + if [ -e "$dir/$soname" ]; then + printf '%s\n' "$dir/$soname" + return 0 + fi + done + command -v ldconfig >/dev/null 2>&1 || return 1 + ldconfig -p 2>/dev/null | awk -v n="$soname" '$1 == n { print $NF; exit }' +} + require_root() { if [ ! -f .gitmodules ] || [ ! -f CMakeLists.txt ]; then echo "error: run this script from the mars-nwe root" >&2 @@ -110,6 +122,14 @@ extract_headers() { } print_cmake_hints() { + pam_lib=$(find_system_lib libpam.so 2>/dev/null || true) + if [ -z "$pam_lib" ]; then + pam_lib=$(find_system_lib libpam.so.0 2>/dev/null || true) + fi + if [ -z "$pam_lib" ]; then + pam_lib=/usr/lib/libpam.so + fi + cat <