Skip to content

fix: use target-specific Debian arch names in Cross.toml#34

Merged
grunch merged 1 commit intomainfrom
fix/cross-toml-arch-mapping
Mar 14, 2026
Merged

fix: use target-specific Debian arch names in Cross.toml#34
grunch merged 1 commit intomainfrom
fix/cross-toml-arch-mapping

Conversation

@mostronatorcoder
Copy link
Contributor

Summary

Fixes the Debian architecture mapping issue in Cross.toml that caused 4 out of 5 cross-compilation targets to fail in v0.1.2 release.


Problem

Release workflow v0.1.2 failed: https://github.com/MostroP2P/mostrix/actions/runs/23092917539

Failed targets:

  • armv7-unknown-linux-gnueabiE: Unable to locate package libssl-dev:armel
  • aarch64-unknown-linux-musl → package not found
  • x86_64-unknown-linux-musl → package not found
  • x86_64-unknown-freebsd → package not found

Only succeeded:

  • x86_64-pc-windows-gnu (by accident, uses different OpenSSL linking)

Root cause: Generic [build] section used $CROSS_DEB_ARCH variable which doesn't map correctly to Debian multi-arch package names for all Rust targets.


Solution

Replace generic configuration with target-specific sections using correct Debian architecture names:

# Before (broken):
[build]
pre-build = [
    "dpkg --add-architecture $CROSS_DEB_ARCH",  # ❌ Wrong for most targets
    "apt-get update",
    "apt-get install -y libssl-dev:$CROSS_DEB_ARCH pkg-config"
]

# After (fixed):
[target.armv7-unknown-linux-gnueabi]
pre-build = [
    "dpkg --add-architecture armhf",  # ✅ Correct Debian arch
    "apt-get update",
    "apt-get install -y libssl-dev:armhf pkg-config"
]
# ... + 4 more target-specific configs

Rust Target → Debian Arch Mapping

Rust Target Debian Arch Notes
x86_64-unknown-linux-musl amd64 Standard x86_64
aarch64-unknown-linux-musl arm64 ARM 64-bit
armv7-unknown-linux-gnueabi armhf Hard-float ABI (not armel)
x86_64-pc-windows-gnu N/A No multi-arch, use native packages
x86_64-unknown-freebsd N/A No multi-arch, use native packages

Key insight: ARMv7 gnueabi suffix doesn't mean soft-float (armel) — it uses hard-float (armhf). This is a common cross-compilation gotcha.


Validation

  • cargo fmt — no changes
  • cargo clippy --all-targets --all-features -- -D warnings — passes
  • cargo test — passes

Next step: After merge, re-trigger v0.1.2 release tag to verify all 5 targets build successfully.


References

Problem: v0.1.2 release failed on 4/5 cross-compilation targets with:
  E: Unable to locate package libssl-dev:armel

Root cause: Cross.toml used $CROSS_DEB_ARCH variable which doesn't map
correctly to Debian architecture names for all Rust targets.

Specifically:
- armv7-unknown-linux-gnueabi needs armhf (not armel)
- aarch64-unknown-linux-musl needs arm64
- x86_64-unknown-linux-musl needs amd64
- Windows/FreeBSD targets don't support multi-arch packages

Solution: Replace generic [build] section with target-specific
configurations that use the correct Debian architecture names:

- x86_64-unknown-linux-musl → amd64
- aarch64-unknown-linux-musl → arm64
- armv7-unknown-linux-gnueabi → armhf
- x86_64-pc-windows-gnu → no multi-arch (install native packages)
- x86_64-unknown-freebsd → no multi-arch (install native packages)

This matches the pattern used in other Rust cross-compilation projects
that depend on OpenSSL (e.g., cargo-chef with explicit target configs).

Verified approach:
- Debian arch names from: https://wiki.debian.org/Multiarch/HOWTO
- Cross target-specific config: https://github.com/cross-rs/cross/wiki/Configuration#target
- ARMv7 gnueabi uses armhf (hard-float ABI), not armel (soft-float)

Fixes failed workflow: https://github.com/MostroP2P/mostrix/actions/runs/23092917539
@grunch grunch merged commit e14b296 into main Mar 14, 2026
10 checks passed
@grunch grunch deleted the fix/cross-toml-arch-mapping branch March 14, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant