Skip to content

Commit a63dd44

Browse files
authored
Fix the incompatibility issue of libwasmedge.0.dylib on macos x86_64 (#338)
* Fix the incompatibility issue of libwasmedge.0.dylib on macos x86_64 * Add arch arg * Use cfg(target_arch) to replace arg
1 parent 5bddabf commit a63dd44

File tree

1 file changed

+16
-3
lines changed
  • packaging/before-packaging-command/src

1 file changed

+16
-3
lines changed

packaging/before-packaging-command/src/main.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,26 @@ fn download_wasmedge_macos(version: &str) -> std::io::Result<()> {
171171
// Command 1: Create the destination directory.
172172
let dest_dir = std::env::current_dir()?.join("wasmedge");
173173
fs::create_dir_all(&dest_dir)?;
174-
174+
#[cfg(target_arch = "x86_64")]
175+
let suffix = "x86_64";
176+
#[cfg(target_arch = "aarch64")]
177+
let suffix = "arm64";
178+
let (wasmedge_download_url, wasi_nn_download_url) = (
179+
format!(
180+
"https://github.com/WasmEdge/WasmEdge/releases/download/{}/WasmEdge-{}-darwin_{}.tar.gz",
181+
version, version, suffix
182+
),
183+
format!(
184+
"https://github.com/WasmEdge/WasmEdge/releases/download/{}/WasmEdge-plugin-wasi_nn-ggml-{}-darwin_{}.tar.gz",
185+
version, version, suffix
186+
),
187+
);
175188
// Command 2: Download and extract WasmEdge.
176189
{
177190
println!("Downloading wasmedge v{version} to: {}", dest_dir.display());
178191
let curl_script_cmd = Command::new("curl")
179192
.arg("-sSfL")
180-
.arg("https://github.com/WasmEdge/WasmEdge/releases/download/0.14.0/WasmEdge-0.14.0-darwin_arm64.tar.gz")
193+
.arg(wasmedge_download_url)
181194
.stdout(Stdio::piped())
182195
.spawn()?;
183196

@@ -209,7 +222,7 @@ fn download_wasmedge_macos(version: &str) -> std::io::Result<()> {
209222
println!("Downloading wasmedge v{version} WASI-NN plugin to: {}", plugin_dest_dir.display());
210223
let curl_script_cmd = Command::new("curl")
211224
.arg("-sSfL")
212-
.arg("https://github.com/WasmEdge/WasmEdge/releases/download/0.14.0/WasmEdge-plugin-wasi_nn-ggml-0.14.0-darwin_arm64.tar.gz")
225+
.arg(wasi_nn_download_url)
213226
.stdout(Stdio::piped())
214227
.spawn()?;
215228

0 commit comments

Comments
 (0)