Skip to content

pack: every packaged ELF gets RUNPATH $ORIGIN only - #3294

Merged
bong-water-water-bong merged 1 commit into
mainfrom
pack/runpath-origin-only
Nov 22, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
pack/runpath-origin-only

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Part of #3287 (release-check row 3 of 5, payload-runpath).

Why: pack_localize kept absolute RUNPATH entries outside the build tree ("HRX needs TheRock anyway"). The entries it kept are TheRock's LLVM runtime dirs (/opt/rocm-therock/lib/python3.14/site-packages/_rocm_sdk_core/lib/llvm/lib/...), which exist on the build host only. On the installed v2026.47 appliance neither path exists, and payload-runpath failed 40 entries (15 libraries plus their symlinks) for it.

Change: patchelf --set-rpath '$ORIGIN' for every localized ELF. What those dirs could provide is already copied beside each library (PACK_BUNDLE_LIBS: libomp), and pack_unresolved_needed (plain ldd, no LD_LIBRARY_PATH) still refuses a package whose NEEDED no longer resolves.

Measured on the hardware: the v2026.47 hrx/llama tree rewritten to $ORIGIN only (26 files, 0 non-$ORIGIN entries left), copied to the installed appliance, runs Qwen3.8-27B UD-Q4_K_XL on HRX0 with the release llama-bench: pp512 481.7, tg64 12.09 tok/s (shipped tree: 505 ± 13 / 12.19), no load errors.

🤖 Generated with Claude Code

pack_localize kept absolute RUNPATH entries outside the build tree, 'since HRX needs TheRock anyway'. The
ones it kept are TheRock's LLVM runtime dirs (/opt/rocm-therock/.../_rocm_sdk_core/lib/llvm/lib/...), which
exist on the build host only: on the installed v2026.47 appliance neither path exists, and the release
check's payload-runpath row failed 40 entries for it. Everything those dirs could provide is copied beside
the library already (PACK_BUNDLE_LIBS: libomp), and pack_unresolved_needed refuses a package whose NEEDED
no longer resolves without LD_LIBRARY_PATH. Measured: the v2026.47 hrx/llama tree rewritten to $ORIGIN
only (26 files) runs Qwen3.8-27B UD-Q4_K_XL on the box's HRX0 with the release llama-bench (pp512 481.7,
tg64 12.09 tok/s; the shipped tree gives 505 +/- 13 / 12.19).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

3287 - Partially compliant

Compliant requirements:

  • payload-runpath: 40 payload libraries still carry a build-tree RUNPATH next to $ORIGIN.

Non-compliant requirements:

  • Stale release-check rows. sealed and npu-kernels-beside-engine look for the older kernel-set layout and fail on a v2026.47 system whose NPU chat passes at about 98 tok/s. Teach both rows the signed-manifest sets that release: ship the signed-manifest NPU kernel sets, and keep the sealed ones working (engine#3237) #3278 ships.
  • xhci-capture: /bin/1bit-xhci-capture is not on the image.
  • The cut must use the freshly rolled payload. A re-roll refreshed the payload tree but not the staged lemonade-onebit-<tag>/ directory the image is cut from, so one image carried the previous engine binary. The cut should build the staged directory from the roll every time and refuse a mismatch.
  • The pre-write probe must be able to stop the write. It printed its result and skipped itself when it could not open the image. It must open the image's own filesystem and exit non-zero on a mismatch or a refusal.
  • Keep the shipped image. The tested image file lived in a build directory outside the backup set and was lost when the build host was reinstalled; the release image was reassembled from the checksum-verified files. Archive the exact tested .img with its hash.
  • NPU chat with tools offered. Lemonade's chat page sends its built-in tools with every message, and the NPU route refuses any request that carries tools. When tools are offered but not required, the NPU route should answer and still parse tool calls the model writes. (Night workaround: a small proxy in front of Lemonade that drops tools for NPU models; it moves Lemonade to an internal port, which also needs LEMONADE_ALLOWED_ORIGINS. Remove both once this lands.)
  • chat-npu-queue-plain: a non-streamed NPU chat queued behind a 1,000-token turn gets no HTTP status at all (the streamed form passes).
  • Qwen3-1.7B on the NPU failed its known-answer gate (4/5) and did not ship; it follows in the next release.

Requires further human verification:

  • Stale release-check rows. sealed and npu-kernels-beside-engine look for the older kernel-set layout and fail on a v2026.47 system whose NPU chat passes at about 98 tok/s. Teach both rows the signed-manifest sets that release: ship the signed-manifest NPU kernel sets, and keep the sealed ones working (engine#3237) #3278 ships.
  • xhci-capture: /bin/1bit-xhci-capture is not on the image.
  • The cut must use the freshly rolled payload. A re-roll refreshed the payload tree but not the staged lemonade-onebit-<tag>/ directory the image is cut from, so one image carried the previous engine binary. The cut should build the staged directory from the roll every time and refuse a mismatch.
  • The pre-write probe must be able to stop the write. It printed its result and skipped itself when it could not open the image. It must open the image's own filesystem and exit non-zero on a mismatch or a refusal.
  • Keep the shipped image. The tested image file lived in a build directory outside the backup set and was lost when the build host was reinstalled; the release image was reassembled from the checksum-verified files. Archive the exact tested .img with its hash.
  • NPU chat with tools offered. Lemonade's chat page sends its built-in tools with every message, and the NPU route refuses any request that carries tools. When tools are offered but not required, the NPU route should answer and still parse tool calls the model writes. (Night workaround: a small proxy in front of Lemonade that drops tools for NPU models; it moves Lemonade to an internal port, which also needs LEMONADE_ALLOWED_ORIGINS. Remove both once this lands.)
  • chat-npu-queue-plain: a non-streamed NPU chat queued behind a 1,000-token turn gets no HTTP status at all (the streamed form passes).
  • Qwen3-1.7B on the NPU failed its known-answer gate (4/5) and did not ship; it follows in the next release.
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

RUNPATH Handling Change

The change modifies how RUNPATH is handled for ELF files by setting it to $ORIGIN only, removing any absolute paths that were previously kept for compatibility with TheRock's LLVM runtime directories. This is a significant change in how dependencies are resolved and could affect systems where those paths were expected to be present.

# engine#3287: $ORIGIN only. The SDK entries this used to keep (TheRock's LLVM runtime dirs under /opt/rocm-therock)
# name directories that exist on the BUILD host only: measured on the installed v2026.47 appliance, neither
# .../_rocm_sdk_core/lib/llvm/lib/... path exists, and the release check's payload-runpath row failed 40 entries
# for it. Everything those dirs could provide is copied beside the library above (PACK_BUNDLE_LIBS: libomp), and
# pack_unresolved_needed (plain ldd, no LD_LIBRARY_PATH) refuses a package whose NEEDED no longer resolves.
patchelf --set-rpath '$ORIGIN' "$f"

@bong-water-water-bong
bong-water-water-bong merged commit 11248c6 into main Nov 22, 2026
11 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the pack/runpath-origin-only branch November 22, 2026 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant