Rpath with $ORIGIN fools snapcraft library bundling mechanism
Metadata
Current evaluation
Fixed by ubuntu-core/snapcraft PR #580 (commit 00e37e57d); snapcraft 2.12 no longer copies libraries already in prime and was successfully verified.
Resolution: closed resolved
Reason: PR #580, commit 00e37e57d, fixed the bundling behavior and shipped in snapcraft 2.12. Verification confirmed that an rpath-test build no longer created the erroneous prime/home directory, and the update was released to xenial -updates.
Evaluated by: mr-cal-bot
No scores available.
Issue body
I have a pre-built binary game using rpath with "$ORIGIN/lib64". Snapcraft expands that to $(pwd)/lib64 (eg /home/zyga/blah/blah/blah/lib64) and a directory like that is added to the snap. At runtime the rpath is still as before so the library cannot be found.
[Impact]
* Wrong paths end up in the snap, which makes it to fail.
[Test Case]
* Make a snap wit $ORIGIN in rpath.
* Run snapcraft
* Install it and execute it.
[Regression Potential]
* This affects the files that end up in the snap. Many scenarios are covered by tests, but some exploratory would be good.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed by ubuntu-core/snapcraft PR #580 (commit 00e37e57d); snapcraft 2.12 no longer copies libraries already in prime and was successfully verified. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by ubuntu-core/snapcraft#580 (commit 00e37e57d), avoiding copies of libraries already in prime; released in snapcraft 2.12 and verified in xenial -updates. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by PR #580 (commit 00e37e57d, 'Don't copy libraries that are already in prime'), shipped in snapcraft 2.12 for xenial; verified by elopio with the new integration_tests/snaps/rpath-test and released to -updates. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed ELF library bundling for prebuilt binaries by preserving RPATH entries containing $ORIGIN. Merged in canonical/snapcraft#1896 as commit c543156ff. | |
| qwen/qwen3.6-35b-a3b | — | — | Snapcraft incorrectly expanded $ORIGIN in rpath to absolute paths, breaking library bundling. The issue was fixed and verified, preserving $ORIGIN correctly during snap builds. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed and verified. Snapcraft incorrectly expanded $ORIGIN in rpath to absolute paths, breaking library bundling. Resolution preserves $ORIGIN during snap building to ensure correct runtime library resolution. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Likely Fixed By:
ubuntu-core/snapcraft#580
(confidence 100%)
Merged fix titled “Don't copy libraries that are already in prime,” shipped in version 2.12.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1746329 Rpath patching overwrites existing rpaths | snapcraft (launchpad) | closed | Fixed by snapcore/snapcraft#1896 (commit c543156ff, 'elf: do not strip rpaths that contain $ORIGIN'): the patcher now prepends existing $ORIGIN rpaths to the snap's own rpath list instead of discarding them. |