Skip to content

Use selective LD_PRELOAD to keep bundled libraries in sync with the host distro - #754

Merged
mehmetozguldev merged 2 commits into
athasdev:mainfrom
theajmalrazaq:fix-linux-tarball-library-precedence
Sep 17, 2026
Merged

mehmetozguldev merged 2 commits into
athasdev:mainfrom
theajmalrazaq:fix-linux-tarball-library-precedence

Conversation

@theajmalrazaq

@theajmalrazaq theajmalrazaq commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

The Linux tarball can fail on newer distributions when its bundled XKB, Fontconfig, or NSS libraries conflict with host data and runtime modules.

Prefer host copies only for XKB, Fontconfig, and NSS/NSPR libraries already present in the bundle. Keep compiler runtimes such as libstdc++ and the CEF graphics runtime bundled. Switch each bundled XKB or NSS/NSPR dependency group together; if any required host copy is unavailable, retain the bundled group. Preserve existing LD_PRELOAD entries and launcher arguments.

Validation: all 55 release tests pass through Vite+, including 16 executable launcher cases covering selection, grouped fallback, x86_64/aarch64 library directories, and argument forwarding. The runtime-library retention test fails against the previous PR implementation. TypeScript, focused lint/format checks, and Bash syntax checks pass.

The tests exercise launcher selection with fixture libraries; they do not prove ELF loading or CEF startup. The revised launcher still needs real application startup checks on Arch Linux and an older supported Ubuntu release. Release dry-run/preflight was attempted in the isolated PR checkout and stopped on release-only main/clean-tree requirements.

Fixes #753

Copilot AI lite review requested due to automatic review settings September 15, 2026 21:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The launcher may override bundled CEF graphics libraries and omits /lib-family paths needed on non-usr-merged systems.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Updates the Linux tarball launcher to prefer host libraries and prevent startup crashes on modern distributions.

Changes:

  • Adds host-library discovery and LD_LIBRARY_PATH configuration.
  • Adds packaging tests for the generated launcher.
File summaries
File Summary
scripts/release/tests/linux-packaging.test.ts Verifies host-library resolution in the launcher.
scripts/release/packaging/linux/tarball.sh Configures host library precedence; requires narrowing the override and covering /lib variants.
Review details

Suppressed comments (1)

scripts/release/packaging/linux/tarball.sh:84

  • The launcher omits the /lib family (/lib, /lib64, and multiarch /lib/*-linux-gnu). On non-usr-merged glibc hosts those are the actual system-library directories; because they are not added to LD_LIBRARY_PATH, the bundled $ORIGIN copies still win over the host libxkbcommon, Fontconfig, and NSS libraries, so the reported crash remains. Add or derive both /lib and /usr/lib variants.
case "$(uname -m)" in
  x86_64 | amd64)
    system_lib_dirs=(
      /usr/lib/x86_64-linux-gnu
      /usr/lib64
      /usr/lib
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

done

if [[ -n "$system_ld_path" ]]; then
export LD_LIBRARY_PATH="${system_ld_path}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
@theajmalrazaq
theajmalrazaq force-pushed the fix-linux-tarball-library-precedence branch from 0f12f33 to 7af0dd6 Compare September 15, 2026 21:13
@theajmalrazaq theajmalrazaq changed the title Prioritize system libraries in Linux tarball launcher to prevent startup crashes Use selective LD_PRELOAD to keep bundled libraries in sync with the host distro Sep 15, 2026
@SnaetWarre

Copy link
Copy Markdown
Contributor

Indeed solves the issue. Works on my CachyOS machine aswell.

@SnaetWarre

Copy link
Copy Markdown
Contributor

thanks for the amazing fix and report!

@mehmetozguldev
mehmetozguldev self-requested a review September 17, 2026 13:42

@SnaetWarre SnaetWarre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Loooks really nice!

…ost distro

The Linux tarball bundles every non-glibc runtime dependency from the CI
runner (Ubuntu).  On newer distros the bundled versions of
system-integration libraries (xkbcommon, fontconfig, NSS, …) are too old,
causing crashes on startup (dead_hamza keysym parse failure, missing
NSSUTIL_3.108 symbols, incompatible fontconfig schemas).

Fix this by LD_PRELOADing the host copy of every bundled library that
exists on the running system, except for CEF's own graphics runtime
(libEGL.so, libGLESv2.so, libvulkan.so.1, libvk_swiftshader.so, libcef.so)
which must remain bundled to avoid ABI/rendering failures.

This is an exclusion-based approach — a small protected_libs list names the
CEF-owned files that must stay bundled, while everything else in libexec/
is automatically overridden when a host copy is found.  No manually
maintained whitelist is needed: new libraries added to the bundle will
get the host-override treatment automatically.

Multi-architecture support: the launcher probes distro-specific library
directories (Debian multiarch, Fedora/RHEL lib64, Arch flat /usr/lib) at
runtime so it works across all major Linux distributions.

Fixes athasdev#753
@theajmalrazaq
theajmalrazaq force-pushed the fix-linux-tarball-library-precedence branch from 7af0dd6 to b8e4a84 Compare September 17, 2026 14:08
Keep compiler and CEF runtimes bundled instead of replacing every shared
library with the host copy. Select XKB and NSS dependency groups together
and retain the bundle when a required host library is missing.

Exercise launcher selection, fallback, library paths, and argument
forwarding with executable shell regression tests.
@mehmetozguldev
mehmetozguldev merged commit 063f5ab into athasdev:main Sep 17, 2026
2 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.

[Linux] Startup segfault on Arch Linux due to bundled library conflicts (xkbcommon, fontconfig, nss)

4 participants