wasmerio/wasmer · error

target {} not yet supported in Wasmer

Error message

target {} not yet supported in Wasmer

What it means

Wasmer's LLVM backend builds an llvm::TargetMachine per target triple and only maps a fixed set of architectures (e.g. x86_64, aarch64, riscv64); any other triple reaches this unimplemented!() panic in target_machine_with_opt.

Source

Thrown at lib/compiler-llvm/src/config.rs:337

            Architecture::Riscv64(_) => InkwellTarget::initialize_riscv(&InitializationConfig {
                asm_parser: true,
                asm_printer: true,
                base: true,
                disassembler: true,
                info: true,
                machine_code: true,
            }),
            Architecture::LoongArch64 => {
                InkwellTarget::initialize_loongarch(&InitializationConfig {
                    asm_parser: true,
                    asm_printer: true,
                    base: true,
                    disassembler: true,
                    info: true,
                    machine_code: true,
                })
            }
            _ => unimplemented!("target {} not yet supported in Wasmer", triple),
        }

        // The CPU features formatted as LLVM strings
        // We can safely map to gcc-like features as the CPUFeatures
        // are compliant with the same string representations as gcc.
        let llvm_cpu_features = cpu_features
            .iter()
            .map(|feature| format!("+{feature}"))
            .join(",");

        let target_triple = self.target_triple(target);
        let llvm_target = InkwellTarget::from_triple(&target_triple).unwrap();
        let mut llvm_target_machine_options = TargetMachineOptions::new()
            .set_cpu(match triple.architecture {
                Architecture::Riscv64(_) => "generic-rv64",
                Architecture::LoongArch64 => "generic-la64",
                _ => "generic",
            })

View on GitHub (pinned to 8c4b9ee9d3)

Solutions

  1. Compile for a supported triple: x86_64, aarch64, or riscv64 (check the match arms in lib/compiler-llvm/src/config.rs)
  2. Use the singlepass or cranelift backend, which support more targets
  3. Verify the target with `wasmer compile --target` / EngineBuilder.target and correct a typo'd triple
  4. Add an arm mapping the new triple to LLVM TargetMachine options if you maintain a fork

Example fix

// before
match triple.architecture() {
    Architecture::X86_64 => { ... }
    Architecture::AmdGcn => { ... }
    _ => unimplemented!("target {} not yet supported in Wasmer", triple),
}
// after
match triple.architecture() {
    Architecture::X86_64 => { ... }
    Architecture::Aarch64(_) => { ... }
    other => return Err(CompileError::UnsupportedTarget(format!("{} not supported by LLVM backend", other))),
}
Defensive patterns

Strategy: validation

Validate before calling

use wasmer_types::{Architecture, Triple};
fn llvm_backend_supported(triple: &Triple) -> bool {
    matches!(triple.architecture,
        Architecture::X86_64 | Architecture::Aarch64(_) | Architecture::Riscv64(_))
}
let engine = if llvm_backend_supported(&target.triple()) {
    EngineBuilder::new(module).set_target(target.clone()).engine()
} else {
    // fall back to cranelift/singlepass
    EngineBuilder::new(module).engine()
};

Type guard

fn is_llvm_supported_arch(triple: &Triple) -> bool {
    matches!(triple.architecture,
        Architecture::X86_64 | Architecture::Aarch64(_) | Architecture::Riscv64(_))
}

Prevention

When it happens

Trigger: Creating an LLVM engine with EngineBuilder/Engine::target set to a triple outside the supported set (e.g. s390x, armv7, mips), or failing to call `to_target`/setting an unsupported host triple when the host architecture itself is unsupported.

Common situations: Cross-compiling to an exotic target; running Wasmer with the LLVM engine on an unsupported host CPU (e.g. powerpc, s390x mainframes); CI images on non-x86_64/arm64 machines.

Related errors


AI-assisted analysis of wasmerio/wasmer@8c4b9ee9d3 (2026-09-01). Data as JSON: /api/errors/851242b932a50aa8. Report an issue: GitHub.