← Back to issue list

many: set rpath for elf files for classic

View original Github issue

Metadata

Project
snapcraft
Number
#1781
Type
pull request
State
merged
Author
sergiusens
Labels
Created
Updated
Closed

Current evaluation

Merged. Configures rpath for ELF files in classic confinement using $ORIGIN and patchelf to eliminate LD_LIBRARY_PATH dependencies, resolving #1663. Approved after resolving CLA checks and transient CI failures.

Suggested action:

No scores available.

Issue body

When working with classic confinement `LD_LIBRARY_PATH` cannot be set without consequences on when other assets on the host are called from the snap. This sets an rpath for every elf file when confinement is set to classic and allows for further extending this mechanism to non classic. When setting rpaths it also makes use of `$ORIGIN` to setup relative paths. Fixes: #1663 Signed-off-by: Sergio Schvezov <sergio.schvezov@canonical.com> - [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [x] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)? - [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)? - [x] Have you successfully run `./runtests.sh static`? - [x] Have you successfully run `./runtests.sh unit`? -----

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Merged. Configures rpath for ELF files in classic confinement using $ORIGIN and patchelf to eliminate LD_LIBRARY_PATH dependencies, resolving #1663. Approved after resolving CLA checks and transient CI failures.
qwen3.6-35b-a3b-mtp-q6 Merged. Sets $ORIGIN rpath for ELF files in classic confinement to avoid LD_LIBRARY_PATH issues and fix #1663. Resolved CI and CLA checks, with maintainers confirming the patchelf approach correctly isolates library resolution.
qwen3.6-35b-a3b-mtp-q6 Merged. Configures rpath for ELF files in classic confinement via $ORIGIN, preventing LD_LIBRARY_PATH conflicts. Fixes #1663 by using patchelf to embed relative paths during prime, ensuring isolated runtime linking.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1094 core: switch to using rpath for clasic confinement. snapcraft merged Merged after reviewer approval and CI checks. The change switches the core module to use RPATH for classic confinement, resolving LP #1657504. The minimal two-file diff adjusts ELF dynamic linker path resolution behavior.
79%
#2019 elf: avoid duplicating rpath entries snapcraft merged Merged fix preventing duplicate $ORIGIN rpath entries in ELF binaries. Approved by reviewer, passed unit and integration tests, and updated two files to generate a single rpath entry.
76%
#2085 elf: clear the current runpath before setting the rpath snapcraft merged Merged changes that clear existing RUNPATH before setting RPATH in ELF files, resolving issue #2071. Approved and passed CI.
74%
#1896 elf: do not strip rpaths that contain $ORIGIN snapcraft merged Merged to preserve ELF rpaths containing $ORIGIN during stripping. This allows custom runtime library paths that snapcraft would otherwise fail to resolve. Approved by reviewer and passed CI checks.
74%
#3985 elf: patch elf files for classic mode snapcraft merged Merged into main. Patches ELF binaries for classic mode to use the base snap interpreter and libraries, or bundled components if libc is staged, when enable-patchelf is enabled. Approved, passed CI, and merged.
72%
#1988 elf: only set rpaths to libs of the same arch snapcraft merged Merged after reviewer approval. Fixes LP #1752964 by restricting ELF rpath resolution to libraries matching the target architecture alongside soname, preventing incorrect selection when multiple architectures exist in the core snap.
70%