cross-rs/cross · error · eyre::ErrReport

unsupported os in target, abi

Error message

unsupported os in target, abi: {abi:?}, system: {system:?} 

What it means

`ImagePlatform::from_target` maps a Rust target triple's (abi, system) pair onto a known Os. If the operating-system/ABI combination is not in the supported table (solaris, android, linux, windows and their recognized variants), it fails, refusing to guess a container image for an unknown platform.

Solutions

  1. Use a target with a supported OS (linux, windows, android, solaris variants).
  2. Provide a custom Docker image for the target in cross config instead of relying on auto-detection.
  3. Check the target triple for typos (e.g. `unknown` in the vendor slot confusing the parse).

Example fix

// before
ImagePlatform::from_target("wasm32-unknown-unknown")? // unsupported os
// after
ImagePlatform::from_target("x86_64-unknown-linux-gnu")?
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED: [&str; 4] = ["linux", "windows", "android", "solaris"];
if !SUPPORTED.iter().any(|os| target.contains(os)) {
    return Err(format!("target {target} has an unsupported OS"));
}

Prevention

When it happens

Trigger: Calling `from_target` (or `ImagePlatform::new`) with a target triple whose OS part is unsupported, e.g. `wasm32-unknown-unknown`, `x86_64-unknown-freebsd`, or `aarch64-apple-darwin` if not handled upstream.

Common situations: Building for exotic/embedded targets, WebAssembly targets, BSD variants, or newly added Rust tier-2/3 targets not yet covered by cross's image mapping.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of cross-rs/cross@8c1a8aa4b6 (2026-09-13). Data as JSON: /api/errors/11a408abfd5511e7. Report an issue: GitHub.

Appendix: source

Thrown at src/docker/image.rs:361

impl Os {
    pub fn from_target(target: &TargetTriple) -> Result<Self> {
        let mut iter = target.triple().rsplit('-');
        Ok(
            match (
                iter.next().ok_or_else(|| eyre::eyre!("malformed target"))?,
                iter.next().ok_or_else(|| eyre::eyre!("malformed target"))?,
            ) {
                ("darwin", _) => Os::Darwin,
                ("freebsd", _) => Os::Freebsd,
                ("netbsd", _) => Os::Netbsd,
                ("illumos", _) => Os::Illumos,
                ("solaris", _) => Os::Solaris,
                // android targets also set linux, so must occur first
                ("android", _) => Os::Android,
                (_, "linux") => Os::Linux,
                (_, "windows") => Os::Windows,
                (abi, system) => {
                    eyre::bail!("unsupported os in target, abi: {abi:?}, system: {system:?} ")
                }
            },
        )
    }

    pub fn new(s: &str) -> Result<Self> {
        use serde::de::IntoDeserializer;

        Self::deserialize(<&str as IntoDeserializer>::into_deserializer(s))
            .wrap_err_with(|| format!("architecture {s} is not supported"))
    }
}

impl std::fmt::Display for Os {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        self.serialize(f)
    }
}

View on GitHub (pinned to 8c1a8aa4b6)