Skip to content

fix: detect missing system shared libraries on Linux#8

Merged
nicoloboschi merged 3 commits intomainfrom
fix/missing-shared-libs-detection
Apr 8, 2026
Merged

fix: detect missing system shared libraries on Linux#8
nicoloboschi merged 3 commits intomainfrom
fix/missing-shared-libs-detection

Conversation

@nicoloboschi
Copy link
Copy Markdown
Collaborator

Summary

  • On some Linux distros (e.g. Arch Linux), system shared libraries like libxml2 may be missing. The dynamic linker fails silently, causing initdb to report a misleading "postgres not found" error
  • After PostgreSQL extraction, runs ldd on the postgres binary (Linux only) and reports any missing .so dependencies with actionable install guidance for Arch, Ubuntu/Debian, and Fedora/RHEL
  • If ldd is unavailable, the check is silently skipped (no blocking)
  • Adds a Docker integration test that deliberately removes libxml2 and verifies the clear error message is surfaced

Ref: vectorize-io/hindsight#919

Test plan

  • CI passes — build compiles on macOS, Docker tests pass on Debian and Alpine
  • New missing-libs-debian-amd64 Docker test passes (removes libxml2, verifies error message)
  • Existing Docker tests still pass (no regression)

On some Linux distros (e.g. Arch Linux), system shared libraries like
libxml2 may be missing. The OS can't execute the postgres binary, causing
initdb to report a misleading "postgres not found" error.

After extraction, run ldd on the postgres binary (Linux only) and report
any missing .so dependencies with actionable install guidance. If ldd is
unavailable, the check is silently skipped.

Adds a Docker integration test that removes libxml2 and verifies the new
error message is surfaced correctly.

Ref: vectorize-io/hindsight#919
- Add Rust build step in CI for the missing-libs test so it uses
  the PR binary (with shared lib detection) instead of the released one
- Rewrite test script to use a mounted script file instead of nested
  heredocs to avoid bash quoting issues
- Require PG0_BINARY_PATH to be set (test needs the PR binary)
The check_shared_libraries function uses &Path but it's gated with
#[cfg(target_os = "linux")]. Use std::path::Path inline to avoid
unused import warnings on non-Linux platforms.
@nicoloboschi nicoloboschi merged commit 7dbbc23 into main Apr 8, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant