← Back to issue list

elf: only set rpaths to libs of the same arch

View original Github issue

Metadata

Project
snapcraft
Number
#1988
Type
pull request
State
merged
Author
kyrofa
Labels
Created
Updated
Closed

Current evaluation

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.

Suggested action:

No scores available.

Issue body

- [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`? ----- This PR is a spike RFC. Tests will fail. This has been tested, and works, but performance will take a hit. I'll be working on the tests (and rebasing onto #1959) tomorrow, but want to get it up tonight so you guys can verify the approach. Currently Snapcraft looks for libs by soname, and gets tripped up if it finds multiple sonames that match (i.e. it takes the first one). This happens in the case of libc coming from the core snap, which includes both amd64's and i386's libc, and it takes i386's libc by default. This PR fixes LP: [#1752964](https://bugs.launchpad.net/snapcraft/+bug/1752964) by matching architecture in addition to soname.

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b 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.
qwen3.6-35b-a3b-mtp-q6 Merged. Fixes LP #1752964 by restricting ELF rpath resolution to libraries matching the target architecture, preventing incorrect cross-architecture selections like i386 over amd64.
qwen3.6-35b-a3b-mtp-q6 Merged fix for LP: #1752964 that restricts ELF rpath assignment to libraries matching the target architecture. This prevents Snapcraft from incorrectly selecting mismatched multi-arch libraries, such as i386 libc for amd64 snaps.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#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.
75%
#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.
73%
#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.
70%
#1781 many: set rpath for elf files for classic snapcraft merged 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.
70%
#2020 elf: set no-default-lib for all elf files if patching snapcraft closed Merged after a reviewer reported a git-ubuntu regression causing empty rpaths. The author could not reproduce it and proposed merging in two weeks to discuss the issue with another maintainer, which was agreed upon.
70%