diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index b6f6ee33b..69b9abb42 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -220,9 +220,21 @@ impl CreateExe { } else { "lib/libwasmer.a" }; + let libwasmer_headless_path = if self + .target_triple + .clone() + .unwrap_or(Triple::host()) + .operating_system + == wasmer_types::OperatingSystem::Windows + { + "lib/wasmer.lib" + } else { + "lib/libwasmer-headless.a" + }; let filename = if let Some(local_tarball) = cross_subc.tarball { let files = untar(local_tarball)?; - files.into_iter().find(|f| f.contains(libwasmer_path)).ok_or_else(|| { + files.clone().into_iter().find(|f| f.contains(libwasmer_headless_path)).or_else(|| + files.into_iter().find(|f| f.contains(libwasmer_path))).ok_or_else(|| { anyhow!("Could not find libwasmer for {} target in the provided tarball path.", target)})? } else { #[cfg(feature = "http")] @@ -230,7 +242,8 @@ impl CreateExe { let release = http_fetch::get_latest_release()?; let tarball = http_fetch::download_release(release, target.clone())?; let files = untar(tarball)?; - files.into_iter().find(|f| f.contains(libwasmer_path)).ok_or_else(|| { + files.clone().into_iter().find(|f| f.contains(libwasmer_headless_path)).or_else(|| + files.into_iter().find(|f| f.contains(libwasmer_path))).ok_or_else(|| { anyhow!("Could not find libwasmer for {} target in the fetched release from Github: you can download it manually and specify its path with the --cross-compilation-library-path LIBRARY_PATH flag.", target)})? } #[cfg(not(feature = "http"))] @@ -456,6 +469,10 @@ impl CreateExe { let mut cmd = Command::new(zig_binary_path); let mut cmd_mut: &mut Command = cmd .arg("cc") + .arg("-w") + .arg("-fgnu-inline-asm") + .arg("-fsanitize=undefined") + .arg("-fsanitize-trap=undefined") .arg("-target") .arg(&zig_triple) .arg(&format!("-L{}", libwasmer_path.display()))