-
Notifications
You must be signed in to change notification settings - Fork 416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix binaryen toolchain URL #1163
Conversation
@@ -164,7 +164,7 @@ pub fn download_prebuilt( | |||
fn prebuilt_url(tool: &Tool, version: &str) -> Result<String, failure::Error> { | |||
let target = if target::LINUX && target::x86_64 { | |||
match tool { | |||
Tool::WasmOpt => "x86-linux", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This previously matched what target::x86
fetches
Is 32 bit x86 no longer packaged? ie does the else if
after this block fail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I can only see x86_64
in the binaryen releases: https://github.com/WebAssembly/binaryen/releases/tag/version_108
Yeah this is not everything. Macos is now still broken.
It refers to |
How about we add a test that checks that the |
Relevant PR: WebAssembly/binaryen#2777 |
Okay, I guess 32-bit x86 was never supported then. Should we just error out if the target == x86 32-bit? |
Yes |
Now I'm getting
This feels too hard to pull off for me :/ I'd appreciate and and all help! |
I've been doing some digging into the wasm-opt dyld errors, and I think I know how this bug can be fixed! The issue seems to be that the binary-install crate isn't downloading the dylib correctly, which I was able to hack around by setting Here's a patch that can be used on top of this PR, which "fixes" the issue on macOS: diff --git a/src/install/mod.rs b/src/install/mod.rs
index 1a77926..612c6da 100644
--- a/src/install/mod.rs
+++ b/src/install/mod.rs
@@ -152,7 +152,7 @@ pub fn download_prebuilt(
}
}
Tool::WasmOpt => {
- let binaries = &["wasm-opt"];
+ let binaries = &["wasm-opt", "libbinaryen"];
match cache.download(install_permitted, "wasm-opt", binaries, &url)? {
Some(download) => Ok(Status::Found(download)),
// TODO(ag_dubs): why is this different? i forget...
diff --git a/src/wasm_opt.rs b/src/wasm_opt.rs
index d3ad4c6..cd8944e 100644
--- a/src/wasm_opt.rs
+++ b/src/wasm_opt.rs
@@ -40,6 +40,7 @@ pub fn run(
let tmp = path.with_extension("wasm-opt.wasm");
let mut cmd = Command::new(&wasm_opt_path);
cmd.arg(&path).arg("-o").arg(&tmp).args(args);
+ cmd.env("DYLD_LIBRARY_PATH", &wasm_opt_path.parent().unwrap());
child::run(cmd, "wasm-opt")?;
std::fs::rename(&tmp, &path)?;
} To fully fix this bug I think it'll be necessary to make a PR to the Separately from all that, I'd also suggest applying this patch, to download the aarch64 version of binaryen on macos. It avoids using Rosetta needlessly. diff --git a/src/install/mod.rs b/src/install/mod.rs
index ab4f6ff..1a77926 100644
--- a/src/install/mod.rs
+++ b/src/install/mod.rs
@@ -180,9 +180,9 @@ pub fn prebuilt_url_for(
let target = match (os, arch, tool) {
(Os::Linux, Arch::X86_64, Tool::WasmOpt) => "x86_64-linux",
(Os::Linux, Arch::X86_64, _) => "x86_64-unknown-linux-musl",
- (Os::MacOS, Arch::X86, _) => bail!("Unrecognized target!"),
- (Os::MacOS, _, Tool::WasmOpt) => "x86_64-macos",
- (Os::MacOS, _, _) => "x86_64-apple-darwin",
+ (Os::MacOS, Arch::X86_64, Tool::WasmOpt) => "x86_64-macos",
+ (Os::MacOS, Arch::X86_64, _) => "x86_64-apple-darwin",
+ (Os::MacOS, Arch::AArch64, Tool::WasmOpt) => "arm64-macos",
(Os::Windows, Arch::X86_64, Tool::WasmOpt) => "x86_64-windows",
(Os::Windows, Arch::X86_64, _) => "x86_64-pc-windows-msvc",
_ => bail!("Unrecognized target!"), |
Thanks for investigating! And yes, I think it makes sense to send a PR to binary-install. Feel free to do so. Would appreciate it! |
This should fix the tests, as a follow-up from #937.