Skip to content
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

wasmer 1.0.0 #68341

Closed
wants to merge 2 commits into from
Closed

wasmer 1.0.0 #68341

wants to merge 2 commits into from

Conversation

chenrui333
Copy link
Member

Created with brew bump-formula-pr.

@BrewTestBot BrewTestBot added no ARM bottle Formula has no ARM bottle rust Rust use is a significant feature of the PR or issue labels Jan 5, 2021
@chenrui333 chenrui333 added the CI-force-arm [DEPRECATED] Don't pass --skip-unbottled-arm to brew test-bot. label Jan 5, 2021
@carlocab
Copy link
Member

carlocab commented Jan 5, 2021

Won't work for ARM yet; needs a new Cargo.lock file: #68301

@carlocab
Copy link
Member

carlocab commented Jan 5, 2021

Upstream issue: wasmerio/wasmer#1986

@chenrui333 chenrui333 added build failure CI fails while building the software and removed CI-force-arm [DEPRECATED] Don't pass --skip-unbottled-arm to brew test-bot. labels Jan 5, 2021
@ezfe
Copy link

ezfe commented Jan 6, 2021

@carlocab Looks like version 1.0.0 fails for a different reason unrelated to --locked?

➜  wasmer git:(aa03cab26) cargo install --path .
error: specified package `wasmer-workspace v1.0.0 (/Users/ezekielelin/temp_dev/wasmer)` has no binaries

Might be misinterpreting this though, apologies if I am

@carlocab
Copy link
Member

carlocab commented Jan 6, 2021

@ezfe Hm, yes, that's entirely possible. I don't have access to an ARM machine myself, and I have a large number of packages to look at, so my method of identifying stale lock files might be a bit crude...

That said, CI (#68089) didn't report a failure for wasmer on ARM when we dropped the --locked flag but did report a failure when we had it, so 🤷. On the other hand, wasmer CI seems to have zero build issues (wasmerio/wasmer#1986), so, again, 🤷.

If you've got an ARM machine you can use, and don't mind looking into what's going on, I'd greatly appreciate it.

@ezfe
Copy link

ezfe commented Jan 6, 2021

@carlocab Yup I have an ARM MacBook Air - I do see it's failing with the error I listed (same as when I run brew install with the modified formula). If there's something I can do to help debug this please let me know what to run. I'm not super familiar with Rust so I don't know how to assess that error beyond its face value.

@carlocab
Copy link
Member

carlocab commented Jan 6, 2021

Thanks, @ezfe. Try reporting the error message you saw over at wasmerio/wasmer#1986; they'll have a better idea of what's going on with your build.

@ezfe
Copy link

ezfe commented Jan 6, 2021

So we've learned that the install command needs to change the --path . to be --path lib/cli here, but we're also waiting for something else unrelated to be fixed way upstream

@richiksc
Copy link
Contributor

richiksc commented Jan 8, 2021

@ezfe The enumset/syn should not be an issue as long as syn is pinned to a version <1.0.58 in Cargo.lock, which it is in wasmer's Cargo.lock file.

@chenrui333 I think if we change the build command to lib/cli it should build.

@carlocab carlocab added the CI-force-arm [DEPRECATED] Don't pass --skip-unbottled-arm to brew test-bot. label Jan 8, 2021
@richiksc
Copy link
Contributor

richiksc commented Jan 8, 2021

Update: I was able to build it succesfully locally on my M1 machine by running:

% cargo install --locked --path lib/cli

@carlocab
Copy link
Member

carlocab commented Jan 8, 2021

I pushed a commit that I think does the same thing. Will change it if it turns out to not be equivalent.

@richiksc
Copy link
Contributor

richiksc commented Jan 8, 2021

I pushed a commit that I think does the same thing. Will change it if it turns out to not be equivalent.

@carlocab This works:

% cd lib/cli
% cargo install --locked --path .

So I'd assume the formula should work now too. We'll see.

@carlocab carlocab removed the build failure CI fails while building the software label Jan 8, 2021
@carlocab
Copy link
Member

carlocab commented Jan 8, 2021

Test failed, but I guess that's progress:

==> brew test --verbose wasmer
==> FAILED
==> Testing wasmer
/usr/bin/sandbox-exec -f /private/tmp/homebrew20210107-47518-1cj7mtm.sb ruby -W0 -I $LOAD_PATH -- /opt/homebrew/Library/Homebrew/test.rb /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/wasmer.rb --verbose
==> /opt/homebrew/Cellar/wasmer/1.0.0/bin/wasmer run /private/tmp/wasmer-test-20210107-47519-1y752si/sum.wasm --invoke sum 1 2
error: failed to run `/private/tmp/wasmer-test-20210107-47519-1y752si/sum.wasm` (no compilers enabled)
│   1: module instantiation failed (engine: jit, compiler: headless)
╰─> 2: Validation error: The JITEngine is not compiled with compiler support, which is required for validating

Error: wasmer: failed
An exception occurred within a child process:
  Test::Unit::AssertionFailedError: <0> expected but was
<1>.

@richiksc
Copy link
Contributor

richiksc commented Jan 8, 2021

Yep, I tried generating a sum.wasm file by running a quick Ruby script with the [...].pack('H*') from the test block and wrote it to a file. The version I built locally from cargo install --locked --path lib/cli came up with the same error:

% cargo install --locked --path lib/cli
[build succesful]
% wasmer run sum.wasm --invoke sum 1 2
error: failed to run `sum.wasm` (no compilers enabled)
│   1: module instantiation failed (engine: jit, compiler: headless)
╰─> 2: Validation error: The JITEngine is not compiled with compiler support, which is required for validating

I was thinking, maybe we are only building the CLI, and the Wasmer engine needs to be built separately as of 1.0.0.. The documentation for Wasmer says that to build wasmer from source you need to run make build-wasmer: https://docs.wasmer.io/ecosystem/wasmer/building-from-source#building-the-wasmer-runtime.

I tried compiling with that on my machine, and nope, same error.

% make build-wasmer
% wasmer run sum.wasm --invoke sum 1 2
error: failed to run `sum.wasm` (no compilers enabled)
│   1: module instantiation failed (engine: jit, compiler: headless)
╰─> 2: Validation error: The JITEngine is not compiled with compiler support, which is required for validating

Edit: Interesting, so the same failure is happening on all versions of macOS - 10.15 and 10.14 builds as well, which are on Intel.

I wanted to check one more thing to see if my generated sum.wasm was malformed, so I created a dead simple Rust program:

pub fn main() {}

#[no_mangle]
pub extern fn sum(a: i32, b: i32) -> i32 {
    a + b
}

and compiled it using rustc --target wasm32-unknown-unknown:

% rustup target add wasm32-unknown-unknown
% rustc --target wasm32-unknown-unknown -O sum.rs
% wasmer run sum.wasm --invoke sum 1 2
error: failed to run `sum.wasm` (no compilers enabled)
│   1: module instantiation failed (engine: jit, compiler: headless)
╰─> 2: Validation error: The JITEngine is not compiled with compiler support, which is required for validating

Same error.

@richiksc
Copy link
Contributor

richiksc commented Jan 8, 2021

@carlocab I was able to get it to build and run on my M1 local machine with this:

% cargo install --locked --path lib/cli --features "cranelift"
% wasmer run sum.wasm --invoke sum 1 2
3

🎉🎉🎉

Looks like as of Wasmer 1.0, you have to specify which compiler it should use. The default compiler, which is compatible with arm64 as well as being the one provided in their CI releases, is cranelift.

Edit: should Homebrew build rust binaries with the --release flag?

@carlocab
Copy link
Member

carlocab commented Jan 8, 2021

@richiksc Sorry, I haven't really had the chance to look at this properly. Can you open a new PR with the changes you propose? Ping me when you do so I can add the flag to force the ARM runner to attempt a build.

@chenrui333 chenrui333 closed this Jan 9, 2021
@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Feb 9, 2021
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Feb 9, 2021
@chenrui333 chenrui333 deleted the bump-wasmer-1.0.0 branch December 18, 2022 05:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CI-force-arm [DEPRECATED] Don't pass --skip-unbottled-arm to brew test-bot. no ARM bottle Formula has no ARM bottle outdated PR was locked due to age rust Rust use is a significant feature of the PR or issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants