← Back to issue list

rust plugin does not cross-compile

View original Github issue

Metadata

Project
craft-parts
Number
#1015
Type
issue
State
open
Author
lengau
Labels
Status: Triaged Type: Bug
Created
Updated
Closed
—

Current evaluation

Rust plugin remains unable to cross-compile and emits host-architecture binaries; target mapping and toolchain setup are identified, but linking and core implementation remain unresolved.

Suggested action: keep open

Reason: The current craft-parts Rust plugin neither sets CARGO_BUILD_TARGET nor passes Cargo --target, and its pull commands do not install the target with rustup. A maintainer supplied a design and reproducible armhf example, but also documented unresolved linker failures; snapcraft#1350 is related work in another project, with no corresponding fix in this repository.

Evaluated by: mr-cal-bot

Impact: 68 Quick Win: 20 Complexity: 64 Confidence: 93 Actionability: 80

Issue body

### Bug Description The `rust` plugin does correctly handle cross-compiling, instead still building for the host architectures. ### To Reproduce 1. Use the `rust` plugin with a different target architecture from the host architecture 2. Examine the output `elf` file(s) ### part yaml ```shell parts: uv: plugin: rust source: https://github.com/astral-sh/uv.git source-tag: $SNAPCRAFT_PROJECT_VERSION build-packages: - cmake build-attributes: - enable-patchelf organize: uv: bin/uv uvx: bin/uvx lib*.so: lib/ ``` ### Relevant log output ```shell $ unsquashfs astral-uv_0.5.29_armhf.snap Parallel unsquashfs: Using 16 processors 5 inodes (321 blocks) to write [==========================================================================================================|] 326/326 100% created 5 files created 4 directories created 0 symlinks created 0 devices created 0 fifos created 0 sockets created 0 hardlinks lengau@ratel:~/Projects/uv-snap$ file squashfs-root/bin/uv squashfs-root/bin/uv: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /snap/core24/current/lib64/ld-linux-x86-64.so.2, BuildID[sha1]=5ea30677c06472fa51db130472ba4f97b74a1786, for GNU/Linux 3.2.0, stripped ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 68
Quick Win: 20
Complexity: 64
Confidence: 93
Actionability: 80
keep open Rust plugin remains unable to cross-compile and emits host-architecture binaries; target mapping and toolchain setup are identified, but linking and core implementation remain unresolved.
qwen/qwen3.6-35b-a3b
Impact: 70
Quick Win: 22
Complexity: 60
Confidence: 80
Actionability: 80
keep open The rust plugin in craft-parts does not support cross-compilation, always building for the host architecture. Maintainer provided a working PR branch.
qwen/qwen3.8-27b
Impact: 65
Quick Win: 26
Staleness: 45
Complexity: 60
Confidence: 70
Support Request: 5
keep open Rust plugin builds for host arch instead of target arch when cross-compiling. Triaged by maintainer with a fix plan (map arch to rust triple, rustup target add, set CARGO_BUILD_TARGET); a working PR branch was shared Aug 2025, but no fix has landed in craft-parts yet.
qwen/qwen3.6-35b-a3b
Staleness: 75
Complexity: 60
Confidence: 85
Support Request: 5
keep open The rust plugin incorrectly builds for the host architecture instead of cross-compiling to the target. Triaged by a maintainer who outlined a fix and linked a working PR, but has seen no activity for over 11 months.
qwen3.6-35b-a3b-mtp-q6
Staleness: 68
Complexity: 45
Confidence: 85
Support Request: 0
keep open Rust plugin fails to cross-compile, building for host architecture instead. Triaged bug with maintainer-proposed fix and a working PR branch, but inactive for over 10 months.

Update history

No update history recorded yet.

Related work

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

    Merged commit 94fb1060e adds Rust cross-compilation support in snapcraft, but the current craft-parts plugin still lacks it.

  • Related To: uv-snap#9 (confidence 90%)

    The maintainer reported that this uv-specific branch appears to work, making it a potential reproducer or workaround rather than a craft-parts fix.

Related issues

Issue Project State Summary Similarity
#1350 rust plugin: Add support for cross-compilation snapcraft merged Merged PR #1350 added --target-arch cross-compilation support for Rust plugin parts in commit 94fb1060e.
75%