← Back to issue list

`enable-patchelf` build-attribute uses `ld` for the build-on host, not the build-for host

View original Github issue

Metadata

Project
snapcraft
Number
#5836
Type
issue
State
open
Author
lengau
Labels
Status: Triaged
Created
Updated
Closed
—

Current evaluation

enable-patchelf picks the dynamic linker from the build-on host arch, so cross-compiled armhf binaries get ld-linux-aarch64.so.1 instead of ld-linux-armhf.so.3. Still unfixed; fix PR #6455 was closed unmerged.

Suggested action: keep open

Reason: The bug is still present at HEAD: `get_dynamic_linker()` in snapcraft/elf/elf_utils.py:113 resolves the arch via `platform.machine()` with no arch parameter, and both call sites in patch_elf (snapcraft/parts/lifecycle.py:675 and :683) omit one, confirming the reported cross-compile interpreter mismatch. Maintainer @lengau opened fix PR #6455, which is closed unmerged with 0 reviewers, so nothing has been resolved. Despite the triaged label and 345-day age, this is a valid, correctly-scoped bug with a concrete reproducer branch (uv-snap candidate-armhf) and an existing design reference in the sibling `get_arch_triplet(arch)` signature, so it should stay open rather than be closed as stale.

Evaluated by: mr-cal-bot

Impact: 45 Quick Win: 23 Complexity: 40 Confidence: 88 Actionability: 85

Issue body

### Bug Description When cross-compiling uv on arm64 for armhf and enabling patchelf, I end up with a 32-bin ARM executable that's interpreted with `/snap/core24/current/lib/ld-linux-aarch64.so.1` rather than `/snap/core24/current/lib/ld-linux-armhf.so.3`. ### To Reproduce Try building [uv-snap](https://github.com/lengau/uv-snap/tree/candidate-armhf) from the `candidate-armhf` branch. ### Environment n/a ### snapcraft.yaml ```yaml https://github.com/lengau/uv-snap/tree/candidate-armhf ``` ### Relevant log output ```shell n/a ``` ### Additional context _No response_

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 45
Quick Win: 23
Complexity: 40
Confidence: 88
Actionability: 85
keep open enable-patchelf picks the dynamic linker from the build-on host arch, so cross-compiled armhf binaries get ld-linux-aarch64.so.1 instead of ld-linux-armhf.so.3. Still unfixed; fix PR #6455 was closed unmerged.
stealth/space-bunny-alpha
Impact: 55
Quick Win: 31
Complexity: 35
Confidence: 85
Actionability: 88
keep open Cross-compiling a classic snap for armhf sets the ELF interpreter from the build-on host arch (ld-linux-aarch64.so.1) instead of the build-for target (ld-linux-armhf.so.3); PR #6455 proposes a fix and awaits review.
qwen/qwen3.6-35b-a3b
Impact: 30
Quick Win: 14
Complexity: 40
Confidence: 80
Actionability: 80
keep open enable-patchelf uses host architecture for dynamic linker selection during cross-compilation, resulting in wrong interpreter path for target binaries
qwen/qwen3.8-27b
Impact: 55
Quick Win: 30
Staleness: 55
Complexity: 45
Confidence: 82
Support Request: 0
keep open Cross-compilation bug: enable-patchelf uses platform.machine() (build host arch) instead of target arch for dynamic linker, producing broken armhf snaps from arm64 hosts. Triaged with Jira ticket SNAPCRAFT-1287, no fix yet.
qwen/qwen3.6-35b-a3b
Staleness: 55
Complexity: 60
Confidence: 90
Support Request: 5
keep open Cross-compilation bug where enable-patchelf incorrectly sets the dynamic linker to the build host ld instead of the target architecture ld. Triaged, awaiting fix.
qwen3.6-35b-a3b-mtp-q6
Staleness: 75
Complexity: 50
Confidence: 80
Support Request: 5
keep open Cross-compiling with enable-patchelf incorrectly sets the dynamic linker for the build-on host instead of the build-for host. Triaged, awaiting fix.

Update history

Date Change
updated

Related work

  • Likely Fixed By: canonical/snapcraft#6455 (confidence 90%)

    PR 'fix(patchelf): use the build-for architecture's dynamic linker' targets patch_elf() for exactly this bug, but is closed unmerged with 0 reviewers, so it provides a design reference rather than a fix.

Related issues

No related issues found above the similarity threshold.