"emscripten" not-found error (trying to get started on yew)

I'm trying to get started on yew, and encountered the "emscripten" not-found error. These are the instructions provided in the error message:

You can install it manually like this:
  curl -O https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz
  tar -xzf emsdk-portable.tar.gz
  source emsdk-portable/emsdk_env.sh
  emsdk update
  emsdk install sdk-incoming-64bit
  emsdk activate sdk-incoming-64bit

I followed and re-executed "./ci/run_tests.sh" again and it stills fails with the same problem.

Computer:yew-master ikevin$ ./ci/run_tests.sh
Is Rust from nightly: 0
Testing for asmjs-unknown-emscripten...
error: you don't have Emscripten installed!

You can install it manually like this:
curl -O https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz
tar -xzf emsdk-portable.tar.gz
source emsdk-portable/emsdk_env.sh
emsdk update
emsdk install sdk-incoming-64bit
emsdk activate sdk-incoming-64bit
Computer:yew-master ikevin$

In fact, re-did it twice and it is still the same.

What can I do to get the yew examples working?

OK. I got it through by:

  1. Setting the "Command Line Tools" in Xcode.

  2. And, re-running "source emsdk-portable/emsdk_env.sh".

However, I'm now hit by another error as I ran ".ci/run-tests.sh":

error: you need to have either Chromium or Chrome installed and in your PATH to run the tests!

Well...

I'm still getting getting emscripten errors:

  = note: Undefined symbols for architecture x86_64:
            "_emscripten_pause_main_loop", referenced from:
                stdweb::webcore::ffi::emscripten::event_loop::h64e93327dc1e0ece in libstdweb-94b0c136d99d231e.rlib(stdweb-94b0c136d99d231e.stdweb.9583r305-cgu.7.rcgu.o)
            "_emscripten_set_main_loop", referenced from:
                stdweb::webcore::ffi::emscripten::event_loop::h64e93327dc1e0ece in libstdweb-94b0c136d99d231e.rlib(stdweb-94b0c136d99d231e.stdweb.9583r305-cgu.7.rcgu.o)
            "_emscripten_asm_const_int", referenced from:
                _$LT$stdweb..webapi..events..dom..ChangeEvent$u20$as$u20$stdweb..webcore..instance_of..InstanceOf$GT$::instance_of::snippet::__cargo_web_snippet_ec28a01a0e33da46726388bff28c564a3ae5afa3::ha1a1d2c83d442d37 in libstdweb-94b0c136d99d231e.rlib(stdweb-94b0c136d99d231e.stdweb.9583r305-cgu.6.rcgu.o)
                _$LT$stdweb..webapi..events..dom..InputEvent$u20$as$u20$stdweb..webcore..instance_of..InstanceOf$GT$::instance_of::snippet::__cargo_web_snippet_513cc5b95412492d529556ccd01ecd4a671a4df8::h2941babcb4a87322 in libstdweb-94b0c136d99d231e.rlib(stdweb-94b0c136d99d231e.stdweb.9583r305-cgu.6.rcgu.o)
                _$LT$yew..html..listener..onchange..Wrapper$LT$T$GT$$u20$as$u20$yew..virtual_dom..Listener$LT$COMP$GT$$GT$::attach::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::snippet::__cargo_web_snippet_cbb54466a17480e2aa3c55a350ddc2f54eb42f54::h64abe990e0e6abd0 in libyew-00107873c13aa156.rlib(yew-00107873c13aa156.5ae278aj12883kll.rcgu.o)
                _$LT$stdweb..webapi..html_elements..select..SelectElement$u20$as$u20$stdweb..webcore..instance_of..InstanceOf$GT$::instance_of::snippet::__cargo_web_snippet_96019afc94417ba3716a0fc16a6f6bb0b478a037::h2000de71a2ce1650 in libstdweb-94b0c136d99d231e.rlib(stdweb-94b0c136d99d231e.stdweb.9583r305-cgu.5.rcgu.o)
                stdweb::webapi::html_elements::select::SelectElement::selected_index::snippet::__cargo_web_snippet_57a2f98b8ead212050903a7563b9d0d12a68c4d4::h0d9a7ad030bcdcf0 in libstdweb-94b0c136d99d231e.rlib(stdweb-94b0c136d99d231e.stdweb.9583r305-cgu.5.rcgu.o)
                stdweb::webapi::storage::Storage::get::snippet::__cargo_web_snippet_3730ae2ea96d69416fa5ec352b8ebb9d03d0f955::h3099bf4aa4a8d933 in libstdweb-94b0c136d99d231e.rlib(stdweb-94b0c136d99d231e.stdweb.9583r305-cgu.5.rcgu.o)
                stdweb::webapi::storage::Storage::insert::snippet::__cargo_web_snippet_8fde8c0fb107bdf550973d062ce5c1188b15ac65::h4155c4a7418d2a58 in libstdweb-94b0c136d99d231e.rlib(stdweb-94b0c136d99d231e.stdweb.9583r305-cgu.5.rcgu.o)
                ...
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
          

error: aborting due to previous error

error: Could not compile `showcase`.

I think I used the wrong command. It should be:

cargo web start

and it seems to be working.

Yes, the appropriate way to start a yew program is to use cargo web start, which generates the page for you and starts a server which serves it.

Do note although that there's a bit of a problem with yew, given its complexity, it can sometimes overwhelm wasm and results with:

So you need to run it in release mode to make it work:

cargo web start --release
1 Like