mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-08 05:38:19 +00:00
create-exe: Prefer libwasmer-headless when cross-compiling
This commit is contained in:
@@ -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()))
|
||||
|
||||
Reference in New Issue
Block a user