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

wasm-opt version error on contract build #247

Closed
rrybarczyk opened this issue Apr 2, 2021 · 2 comments · Fixed by #248
Closed

wasm-opt version error on contract build #247

rrybarczyk opened this issue Apr 2, 2021 · 2 comments · Fixed by #248

Comments

@rrybarczyk
Copy link

This error has been replicated on both Arch Linux (by installing binaryen via $ yay binaryen) and OSX (by installing binaryen via $ brew install binaryen).

After installing binaryen with the preferred installation method, running $ cargo +nightly contract build fails with the following error:

ERROR: Unable to extract version information from wasm-opt version 100.
Your wasm-opt version is most probably too old. Make sure you use a version >= 99.

However, the wasm-opt version installed is the latest:

$ wasm-opt --version
> wasm-opt version 100

I also tried building the tagged wasm-opt version 99, which confusingly installed wasm-opt version 98. When trying to build with this version, it expectedly does not work.

The work around to this is by using the unpreferred method of building binaryen as a dependency when installing cargo-contract:

cargo install --force --features binaryen-as-dependency cargo-contract
@rrybarczyk rrybarczyk changed the title wasm-opt version error on build wasm-opt version error on contract build Apr 2, 2021
@netrikare
Copy link

It looks like wasm-opt version checking regex assumes additional string after version number. Solution:
change:
let re = Regex::new(r"wasm-opt version (\d+)\s+").unwrap();
to:
let re = Regex::new(r"wasm-opt version (\d+)\s*+").unwrap();

in src/cmd/build.rs

@cmichi
Copy link
Collaborator

cmichi commented Apr 6, 2021

Thanks @rrybarczyk and @netrikare! Sorry about the late response, just saw it this morning, the easter holidays collided with this ticket unfortunately 🙈.

We just issued a new release which fixes this issue and will make some adaptions to our CI setup to catch stuff like this earlier.

You can update to the latest version via

cargo install cargo-contract --version ^0.11 --force --locked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants