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

assertion when using cargo run with wasm32-unknown-emscripten #4689

Open
japaric opened this issue Oct 31, 2017 · 7 comments
Open

assertion when using cargo run with wasm32-unknown-emscripten #4689

japaric opened this issue Oct 31, 2017 · 7 comments
Labels
Command-run O-wasm OS: WASM target released issues S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.

Comments

@japaric
Copy link
Member

japaric commented Oct 31, 2017

STR

$ rustup default nightly-2017-10-28

$ cargo install cross --vers 0.1.12

$ cargo new --bin hello && cd $_

$ cross run --target wasm32-unknown-emscripten
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `2`,
 right: `1`', /checkout/src/tools/cargo/src/cargo/ops/cargo_run.rs:54:4
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at /checkout/src/libstd/sys_common/backtrace.rs:69
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/sys_common/backtrace.rs:58
             at /checkout/src/libstd/panicking.rs:381
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:397
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:577
   5: std::panicking::begin_panic
             at /checkout/src/libstd/panicking.rs:538
   6: std::panicking::begin_panic_fmt
             at /checkout/src/libstd/panicking.rs:522
   7: cargo::ops::cargo_run::run
   8: cargo::run::execute
   9: _ZN5cargo27try_execute_builtin_command17h01b8ca659cc53ea7E.llvm.40E9B093
  10: _ZN5cargo7execute17h4a8d8dd20dfaa5afE.llvm.40E9B093
  11: _ZN5cargo23call_main_without_stdin17h8b50800c4cb9e0c3E.llvm.40E9B093
  12: _ZN5cargo4main17h20b4285ce6c0c7edE.llvm.40E9B093
  13: __rust_maybe_catch_panic
             at /checkout/src/libpanic_unwind/lib.rs:99
  14: std::rt::lang_start
             at /checkout/src/libstd/panicking.rs:459
             at /checkout/src/libstd/panic.rs:361
             at /checkout/src/libstd/rt.rs:59
  15: __libc_start_main
  16: <unknown>

nightly-2017-10-24 works fine. You get Hello, world!.

It seems that the difference is that with nightly-2017-10-24 Cargo produces a single .js file:

$ ls target/wasm32-unknown-emscripten/debug/hello*
target/wasm32-unknown-emscripten/debug/hello.d  target/wasm32-unknown-emscripten/debug/hello.js

But with nightly-2017-10-28 Cargo produces a .js and a .wasm file.

$ ls target/wasm32-unknown-emscripten/debug/hello*
target/wasm32-unknown-emscripten/debug/hello.d   target/wasm32-unknown-emscripten/debug/hello.wasm
target/wasm32-unknown-emscripten/debug/hello.js

Cross is using the Cargo runner feature under the hood (set to node-wasm) so that could be related.

@alexcrichton
Copy link
Member

cc @tatsuya6502 mind taking a look at this? I think it was caused by #4570

@tatsuya6502
Copy link
Contributor

mind taking a look at this? I think it was caused by #4570

@alexcrichton Sure. I will take a look.

@richard-uk1
Copy link
Contributor

richard-uk1 commented Nov 4, 2017

The problem is that cargo expects a single file (exe) to be output, but for wasm 2 files are produced, hence the 2 != 1 assertion error.

It would be cool if cargo could run node when you do cargo run - I'm not sure if this is the current behaviour. I'm going to have a look to answer this question - just wanted to post that I'm looking at it.

@stale
Copy link

stale bot commented Sep 19, 2018

As there hasn't been any activity here in over 6 months I've marked this as stale and if no further activity happens for 7 days I will close it.

I'm a bot so this may be in error! If this issue should remain open, could someone (the author, a team member, or any interested party) please comment to that effect?

The team would be especially grateful if such a comment included details such as:

  • Is this still relevant?
  • If so, what is blocking it?
  • Is it known what could be done to help move this forward?

Thank you for contributing!

(The cargo team is currently evaluating the use of Stale bot, and using #6035 as the tracking issue to gather feedback.)

If you're reading this comment from the distant future, fear not if this was closed automatically. If you believe it's still an issue please leave a comment and a team member can reopen this issue. Opening a new issue is also acceptable!

@stale stale bot added the stale label Sep 19, 2018
@stale
Copy link

stale bot commented Oct 19, 2018

As I didn't see any updates in 30 days I'm going to close this. Please see the previous comment for more information!

@stale stale bot closed this as completed Oct 19, 2018
@malbarbo
Copy link
Contributor

This issue is still relevant. Running the described commands produces the error:

thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `2`,
 right: `1`', tools/cargo/src/cargo/ops/cargo_run.rs:79:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

@alexcrichton alexcrichton reopened this Oct 19, 2018
@stale stale bot removed the stale label Oct 19, 2018
@ehuss ehuss added O-wasm OS: WASM target released issues Command-run labels Sep 23, 2019
@ehuss
Copy link
Contributor

ehuss commented Aug 17, 2020

This appears to be fixed, can someone confirm?

@epage epage added the S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. label Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Command-run O-wasm OS: WASM target released issues S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.
Projects
None yet
Development

No branches or pull requests

7 participants