{"record":{"id":"b1d782b2abed12db","repo":"denoland/deno","slug":"cross-compiling-with-snapshot-is-not-supported","errorCode":null,"errorMessage":"Cross compiling with snapshot is not supported.","messagePattern":"Cross compiling with snapshot is not supported\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/build.rs","lineNumber":558,"sourceCode":"\n  check_appimage_runtime_hashes();\n  compress_appimage_runtimes(&out_dir);\n\n  // Skip building from docs.rs.\n  if env::var_os(\"DOCS_RS\").is_some() {\n    return;\n  }\n\n  deno_napi::print_linker_flags(\"deno\");\n  deno_webgpu::print_linker_flags(\"deno\");\n\n  // Host snapshots won't work when cross compiling.\n  let target = env::var(\"TARGET\").unwrap();\n  let host = env::var(\"HOST\").unwrap();\n  let skip_cross_check =\n    env::var(\"DENO_SKIP_CROSS_BUILD_CHECK\").is_ok_and(|v| v == \"1\");\n  if !skip_cross_check && target != host {\n    panic!(\"Cross compiling with snapshot is not supported.\");\n  }\n\n  // To debug snapshot issues uncomment:\n  // op_fetch_asset::trace_serializer();\n\n  emit_startup_order_link_args(&out_dir);\n  process_node_types(&out_dir);\n\n  // Always emit rerun-if-changed for dts files (they are included via\n  // include_str! in debug mode). Without this, cargo may use stale\n  // cached artifacts when dts files change.\n  emit_dts_rerun_if_changed();\n\n  if !cfg!(debug_assertions) && std::env::var(\"CARGO_FEATURE_HMR\").is_err() {\n    compress_sources(&out_dir);\n  }\n\n  if let Ok(c) = env::var(\"DENO_CANARY\") {","sourceCodeStart":540,"sourceCodeEnd":576,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/build.rs#L540-L576","documentation":"Build-script panic in cli/build.rs. Deno's default builds embed a V8 startup snapshot that was generated on the build host; a snapshot built for the host architecture will not run on a different TARGET. Unless the cross-build check is explicitly skipped, building the deno crate for a target triple different from HOST aborts with this message.","triggerScenarios":"Running `cargo build --target <other-triple>` (e.g. host x86_64-linux building aarch64-linux) where TARGET != HOST while the snapshot feature is enabled, without DENO_SKIP_CROSS_BUILD_CHECK=1.","commonSituations":"Packagers cross-compiling Deno for ARM boards or musl from an x86_64 host; CI matrix jobs that set --target for smoke tests; contributors experimenting with foreign targets.","solutions":["If you know the snapshot is valid for the target (e.g. you supplied one), opt out of the guard: `export DENO_SKIP_CROSS_BUILD_CHECK=1`","Otherwise build natively on/emulate the target platform (QEMU, native runner, cross toolchain with a target-generated snapshot)","Check Deno's official release workflow for the supported way to produce target binaries"],"exampleFix":"# before\ncargo build --release --target aarch64-unknown-linux-gnu  # panics\n# after\nexport DENO_SKIP_CROSS_BUILD_CHECK=1\ncargo build --release --target aarch64-unknown-linux-gnu","handlingStrategy":"validation","validationCode":"T=$(rustc -vV | awk '/^host:/ {print $2}')\nif [ -n \"${CARGO_BUILD_TARGET:-}\" ] && [ \"$CARGO_BUILD_TARGET\" != \"$T\" ]; then\n  export DENO_SKIP_CROSS_BUILD_CHECK=1   # only if the snapshot is known-valid for the target\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer native builds or official cross-build workflow for release binaries","Understand that skipping the check with a host snapshot produces a binary that will fail at runtime on the target"],"tags":["build-script","cross-compilation","snapshot","cargo-target"],"backgroundTag":"cross-compilation-unsupported","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}