wasmerio/wasmer · error
x86 support requires SSE2
Error message
x86 support requires SSE2
What it means
CraneliftCompiler::isa builds the target ISA description for compilation. On X86_64 targets the code requires the SSE2 CPU feature — it is the baseline for 64-bit x86 backend support — and panics if the target's CPU feature set lacks it. This guarantees the generated code meets the x86-64 baseline ISA.
Source
Thrown at lib/compiler-cranelift/src/config.rs:193
self
}
/// The optimization levels when optimizing the IR.
pub fn opt_level(&mut self, opt_level: CraneliftOptLevel) -> &mut Self {
self.opt_level = opt_level;
self
}
/// Generates the ISA for the provided target
pub fn isa(&self, target: &Target) -> CodegenResult<Arc<dyn TargetIsa>> {
let mut builder =
lookup(target.triple().clone()).expect("construct Cranelift ISA for triple");
// Cpu Features
let cpu_features = target.cpu_features();
if target.triple().architecture == Architecture::X86_64
&& !cpu_features.contains(CpuFeature::SSE2)
{
panic!("x86 support requires SSE2");
}
if cpu_features.contains(CpuFeature::SSE3) {
builder.enable("has_sse3").expect("should be valid flag");
}
if cpu_features.contains(CpuFeature::SSSE3) {
builder.enable("has_ssse3").expect("should be valid flag");
}
if cpu_features.contains(CpuFeature::SSE41) {
builder.enable("has_sse41").expect("should be valid flag");
}
if cpu_features.contains(CpuFeature::SSE42) {
builder.enable("has_sse42").expect("should be valid flag");
}
if cpu_features.contains(CpuFeature::POPCNT) {
builder.enable("has_popcnt").expect("should be valid flag");
}
if cpu_features.contains(CpuFeature::AVX) {
builder.enable("has_avx").expect("should be valid flag");View on GitHub (pinned to 8c4b9ee9d3)
Solutions
- Add CpuFeature::SSE2 to the target's cpu_features when constructing a custom x86_64 Target.
- Use target detection from the host (Cpu::for_native / Target::new default) instead of hand-built feature sets.
- If deliberately targeting non-SSE2 x86, that is unsupported — switch to a supported baseline or a different architecture.
- Verify with lscpu / cpuinfo that the execution environment actually reports SSE2.
Example fix
// before let mut target = Target::new(triple, cpu_features_without_sse2); // after let mut cpu_features = EnumSet::new(); cpu_features.insert(CpuFeature::SSE2); // required baseline for x86_64 let target = Target::new(triple, cpu_features);
Defensive patterns
Strategy: validation
Validate before calling
use wasmer_compiler::{CpuFeature, Target, Triple};
use enumset::EnumSet;
fn assert_x86_64_baseline(triple: &Triple, feats: &EnumSet<CpuFeature>) {
if triple.architecture == target_lexicon::Architecture::X86_64
&& !feats.contains(CpuFeature::SSE2)
{
panic!("custom x86_64 target must include CpuFeature::SSE2");
}
} Prevention
- Always include SSE2 when hand-building x86_64 Targets.
- Prefer native CPU detection over manual feature sets.
- Verify target CPU models in emulators report baseline x86-64 features.
When it happens
Trigger: Calling isa() (during compiler construction / module compilation) with a target whose declared cpu_features do not include SSE2 — typically after building a custom Target with manually cleared/omitted features rather than from native CPU detection.
Common situations: Constructing a cross-compilation Target programmatically and forgetting to add CpuFeature::SSE2; targeting emulators/qemu CPU models that mask SSE2; custom engine configs supplying an explicit target triple + feature set that omits baseline features.
Related errors
- cannot create debug directory: {}
- global #{} is a constant
- Unsupported libcall
- not a `sys` backend!
- Unsupported backend kind {v:?}
AI-assisted analysis of wasmerio/wasmer@8c4b9ee9d3 (2026-09-01).
Data as JSON: /api/errors/c67c9ecbfea96e0a.
Report an issue: GitHub.