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

feat(core): use wasm3 to generate witness #127

Closed
wants to merge 3 commits into from
Closed

Conversation

vivianjeng
Copy link
Collaborator

@vivianjeng vivianjeng commented Apr 11, 2024

      error: failed to run custom build command for `wasm3-sys v0.5.0 (https://github.com/wasm3/wasm3-rs.git#df74c2a1)`

Caused by:
  process didn't exit successfully: `/Users/zhengyawen/Documents/GitHub/mopro/target/release/build/wasm3-sys-9fc7db572a976c79/build-script-build` (exit status: 101)
  --- stderr
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/cdefs.h:1022:2: error: Unsupported architecture
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/machine/_types.h:36:2: error: architecture not supported
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:55:9: error: unknown type name '__int64_t'
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:56:9: error: unknown type name '__int32_t'
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:57:9: error: unknown type name '__int32_t'
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:60:9: error: unknown type name '__uint32_t'
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:61:9: error: unknown type name '__uint32_t'
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:62:9: error: unknown type name '__uint64_t'
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:68:9: error: unknown type name '__darwin_natural_t'
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:70:9: error: unknown type name '__uint16_t'
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:71:9: error: unknown type name '__int64_t'
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:72:9: error: unknown type name '__int32_t'
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:73:9: error: unknown type name '__uint32_t'
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:74:9: error: unknown type name '__int32_t'
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:75:9: error: unknown type name '__uint32_t'
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:76:9: error: unknown type name '__uint32_t'
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/_types.h:43:9: error: unknown type name '__uint32_t'
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/machine/signal.h:36:2: error: architecture not supported
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/machine/_mcontext.h:36:2: error: architecture not supported
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/cdefs.h:1022:2: error: Unsupported architecture, err: true
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/machine/_types.h:36:2: error: architecture not supported, err: true
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:55:9: error: unknown type name '__int64_t', err: true
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:56:9: error: unknown type name '__int32_t', err: true
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:57:9: error: unknown type name '__int32_t', err: true
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:60:9: error: unknown type name '__uint32_t', err: true
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:61:9: error: unknown type name '__uint32_t', err: true
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:62:9: error: unknown type name '__uint64_t', err: true
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:68:9: error: unknown type name '__darwin_natural_t', err: true
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:70:9: error: unknown type name '__uint16_t', err: true
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:71:9: error: unknown type name '__int64_t', err: true
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:72:9: error: unknown type name '__int32_t', err: true
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:73:9: error: unknown type name '__uint32_t', err: true
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:74:9: error: unknown type name '__int32_t', err: true
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:75:9: error: unknown type name '__uint32_t', err: true
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:76:9: error: unknown type name '__uint32_t', err: true
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/_types.h:43:9: error: unknown type name '__uint32_t', err: true
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/machine/signal.h:36:2: error: architecture not supported, err: true
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/machine/_mcontext.h:36:2: error: architecture not supported, err: true
  fatal error: too many errors emitted, stopping now [-ferror-limit=], err: true
  thread 'main' panicked at /Users/zhengyawen/.cargo/git/checkouts/wasm3-rs-a44766fb80123c43/df74c2a/wasm3-sys/build.rs:111:10:
  Failed to generate bindings: ()
  stack backtrace:
     0:        0x102768e5c - std::backtrace_rs::backtrace::libunwind::trace::hf755a955ad018943
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
     1:        0x102768e5c - std::backtrace_rs::backtrace::trace_unsynchronized::hde69ab8e2b667964
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
     2:        0x102768e5c - std::sys_common::backtrace::_print_fmt::hf6c414569af631f5
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/sys_common/backtrace.rs:67:5
     3:        0x102768e5c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0524bd1b527203b8
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/sys_common/backtrace.rs:44:22
     4:        0x102787fdc - core::fmt::rt::Argument::fmt::ha0532872e39381ee
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/fmt/rt.rs:138:9
     5:        0x102787fdc - core::fmt::write::h74be1333b0a6ddea
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/fmt/mod.rs:1114:21
     6:        0x102765b3c - std::io::Write::write_fmt::h6c011b665b2d7d4b
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/io/mod.rs:1763:15
     7:        0x102768c9c - std::sys_common::backtrace::_print::hcc60dadc0e4df78f
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/sys_common/backtrace.rs:47:5
     8:        0x102768c9c - std::sys_common::backtrace::print::he25ff7dac6402434
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/sys_common/backtrace.rs:34:9
     9:        0x10276a888 - std::panicking::default_hook::{{closure}}::h41763ba018b93bf7
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:272:22
    10:        0x10276a5a0 - std::panicking::default_hook::h017c44660373840e
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:292:9
    11:        0x10276adcc - std::panicking::rust_panic_with_hook::h221a0baf52ecd48a
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:731:13
    12:        0x10276acd4 - std::panicking::begin_panic_handler::{{closure}}::h18b661cf0f97a414
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:609:13
    13:        0x1027692e8 - std::sys_common::backtrace::__rust_end_short_backtrace::h4f4b2ffab2311217
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/sys_common/backtrace.rs:170:18
    14:        0x10276aa40 - rust_begin_unwind
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:597:5
    15:        0x1027a06ac - core::panicking::panic_fmt::hd6070cd222575be5
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/panicking.rs:72:14
    16:        0x1027a0a04 - core::result::unwrap_failed::h54ffffcb65858936
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/result.rs:1652:5
    17:        0x102264448 - core::result::Result<T,E>::expect::h63e34765fc5315e9
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/result.rs:1034:23
    18:        0x102267188 - build_script_build::gen_bindings::h0f71796a1b13e32f
                                 at /Users/zhengyawen/.cargo/git/checkouts/wasm3-rs-a44766fb80123c43/df74c2a/wasm3-sys/build.rs:94:5
    19:        0x102267378 - build_script_build::main::h9f05f8a482c1bc1d
                                 at /Users/zhengyawen/.cargo/git/checkouts/wasm3-rs-a44766fb80123c43/df74c2a/wasm3-sys/build.rs:117:5
    20:        0x1022630b0 - core::ops::function::FnOnce::call_once::h35c6204b5cec7acb
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/ops/function.rs:250:5
    21:        0x1022625bc - std::sys_common::backtrace::__rust_begin_short_backtrace::hcef8e49ebe0c9db2
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/sys_common/backtrace.rs:154:18
    22:        0x102262d98 - std::rt::lang_start::{{closure}}::hc40992a14c50f672
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/rt.rs:166:18
    23:        0x102761970 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h44482c562109b08c
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/ops/function.rs:284:13
    24:        0x102761970 - std::panicking::try::do_call::h627d61d518625eaf
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:504:40
    25:        0x102761970 - std::panicking::try::h487b8df834773e7d
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:468:19
    26:        0x102761970 - std::panic::catch_unwind::h5d4366c6f71d3443
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panic.rs:142:14
    27:        0x102761970 - std::rt::lang_start_internal::{{closure}}::h749338e1cc06c4f7
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/rt.rs:148:48
    28:        0x102761970 - std::panicking::try::do_call::h2098bd254e5cae95
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:504:40
    29:        0x102761970 - std::panicking::try::h7bfd8a0246bca0f8
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:468:19
    30:        0x102761970 - std::panic::catch_unwind::h6da51257cc975c65
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panic.rs:142:14
    31:        0x102761970 - std::rt::lang_start_internal::h5f00c09289a72e67
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/rt.rs:148:20
    32:        0x102262d64 - std::rt::lang_start::h1c2dc5c5ababc103
                                 at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/rt.rs:165:17
    33:        0x102267a30 - _main
warning: build failed, waiting for other jobs to finish...
note: If the build failed due to a missing target, you can run this command:
note: 
note:     rustup target install aarch64-linux-android

Script did not finish successfully!
(base) ➜  mopro git:(new-wasm3) ✗ rustup target install aarch64-linux-android
info: component 'rust-std' for target 'aarch64-linux-android' is up to date

Copy link
Collaborator

@oskarth oskarth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Do you have any idea:

  1. Why it works?
  2. Why it is slower?

I think since it doesn't 100% work on Android yet and is quite a bit slower it might be best to have it as a feature flag. Though ideally we can simplify this soon and not to have many branches/options...

@vivianjeng
Copy link
Collaborator Author

Here is a good report: https://00f.net/2021/02/22/webassembly-runtimes-benchmarks/
wasmer is a runtime but wasm3 is an interpreter.
though wasm3 performance is worse than all the other runtime but it is the most portable (according to the report)
(and here is the lastest benchmark report: https://00f.net/2023/01/04/webassembly-benchmark-2023/
but it mentions wasm3 less.)

I will try to fix it to see if it works on android 😅
or we should keep it a feature flag for ios-deploy

@oskarth oskarth force-pushed the main branch 2 times, most recently from 1ecda3d to 50a9833 Compare May 22, 2024 03:37
@oskarth oskarth mentioned this pull request May 23, 2024
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 this pull request may close these issues.

2 participants