← 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

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.

Suggested action: keep open

Reason: The bug is confirmed in code: get_dynamic_linker() in elf_utils.py uses platform.machine() rather than the target architecture, and patch_elf() in lifecycle.py calls get_arch_triplet() without passing the target arch. The issue is triaged (Status: Triaged label, Jira SNAPCRAFT-1287), the code still exhibits the bug, and no fix PR exists. Last human activity is absent but the bug remains valid and unfixed.

Impact: 55 Quick Win: 30.25 Staleness: 55 Complexity: 45 Confidence: 82 Support Request: 0

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
qwen/qwen3.8-27b
Impact: 55
Quick Win: 30.25
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.
qwen3.6-35b-a3b-mtp-q6
Staleness: 55
Complexity: 60
Confidence: 85
Support Request: 5
keep open enable-patchelf incorrectly uses the host dynamic linker instead of the target linker during cross-compilation, causing architecture mismatches. Triaged and tracked internally, but inactive for over four months and awaiting development attention.

Update history

No update history recorded yet.

Related issues

No related issues found above the similarity threshold.