← Back to issue list

elf: cleaner patchelf experience

View original Github issue

Metadata

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

Current evaluation

Merged as df6992224: Snapcraft now prefers system Patchelf outside snaps and copies target files to avoid hard-link patching conflicts.

Resolution: closed resolved

Reason: PR #1873 was merged as commit df6992224, implementing the cleaner Patchelf workflow. It added clearer build-tool guidance and safe file copying before patching.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Use the patchelf on the system by default if not running from the snap and if it fails instruct the user to use patchelf as a part or as a build-snaps entry. Given that when using as a part the user can choose to not use filters to remove the file from prime, we also make a copy of the file to patch (breaking any potential existing hard link with the other steps) to avoid the problem of trying to patch the patchelf primed file with the same patchelf binary file. 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
stealth/space-bunny-alpha — closed resolved Merged as df6992224: Snapcraft now prefers system Patchelf outside snaps and copies target files to avoid hard-link patching conflicts.
stealth/space-bunny-alpha — closed resolved Merged PR #1873 as commit df6992224, defaulting to system patchelf outside the snap and copying files to prevent hard-link conflicts.
qwen/qwen3.6-35b-a3b — — Merged improvements to patchelf handling. The change uses the system patchelf by default, copies files to prevent hard-link conflicts, and provides fallback instructions. Approved by two reviewers and passed CI checks before merging.
qwen3.6-35b-a3b-mtp-q6 — — Merged after fixing tests and receiving approval. Improves patchelf handling by defaulting to the system binary, copying files before patching to prevent hard-link conflicts, and providing clear fallback instructions.

Update history

No update history recorded yet.

Related work

  • Related To: snapcraft#1888 (confidence 95%)

    Follow-up PR #1888, merged as 7c947f5ec, delivered Patchelf through Snapcraft's supported packaging paths.

Related issues

Issue Project State Summary Similarity
#1888 elf: make patchelf a dependency snapcraft merged Merged PR #1888 via commit 7c947f5ec, moving Patchelf out of project_loader build tools and into the deb and snap delivery mechanisms.
78%
#2081 elf: patch everything instead of a subset of elf files snapcraft merged Merged PR #2081 restored Snapcraft 2.39 behavior by patching every ELF file; commit 77770452b partially reverted 64f78f762a05.
77%
#2528 packaging: use our patchelf branch snapcraft merged Merged (commit bd26cafd6, squashed merge of #2528): snapcraft.yaml now points patchelf sources at Snapcore's own patchelf branch with the failing s390x test disabled, unblocking s390x package builds; later reverted by #2531.
76%
#1669 patchelf with ld-linux from the future snapcraft closed Resolved by commit bdaf0b7f1, which added Snapcraft handling for PatchELF and ELF files when the built glibc/linker does not match the base.
76%
#1794 Apply patchelf work to non classic snapcraft closed Patchelf support was extended from classic confinement to strict snaps by merged PR #3277 (commit fd8e95c3d), resolving #1794.
76%
#3841 elf: add elf file patcher snapcraft merged Merged PR #3841 in commit e03a971b3, adding a patchelf-based ELF file patcher ported from Snapcraft 6.x for CRAFT-1191.
76%
#1935 elf: contemplate more patching scenarios snapcraft merged Merged PR #1935 as 048adc4a3, adding ELF patching for classic snaps built on bionic targeting core16 and for hooks built with Snapcraft.
75%
#3589 snap: correct patch apply for patchelf snapcraft merged Merged PR #3589 fixed PatchELF patch application in the snap build via commit d9484faf9 (merge a636d26b5).
75%
#1742707 patchelf is missing from snapcraft Depends: snapcraft (launchpad) closed Reported missing patchelf apt dependency since snapcraft 2.38. Fixed by PR #1888 (commit 7c947f5ec, "elf: make patchelf a dependency"), released in snapcraft 2.40; issue closed by sergiusens.
75%
#3277 pluginhandler: support using patchelf on strict snaps snapcraft merged Merged PR #3277 as fd8e95c3d, adding per-part enable-patchelf support to patch ELF rpaths and interpreters in strictly confined snaps.
73%