Yew: Can't get example working

Created on 9 Aug 2018  路  10Comments  路  Source: yewstack/yew

Description

I'm submitting a ... question / bug report

yew - latest
cargo-web 0.6.15
Unix ubuntu
emscripten 1.38.11 (clang e1.38.11_64bit)

  = note: INFO:root:generating system library: dlmalloc_debug.bc... (this will be cached in "/home/trsh/.emscripten_cache/asmjs/dlmalloc_debug.bc" for subsequent builds)
          /home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/system/lib/dlmalloc.c:891:27: warning: incompatible redeclaration of library function 'malloc' [-Wincompatible-library-redeclaration]
              DLMALLOC_EXPORT void* dlmalloc(size_t);
                                    ^
          /home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/system/lib/dlmalloc.c:855:32: note: expanded from macro 'dlmalloc'
          #define dlmalloc               malloc
                                         ^
          /home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/system/lib/dlmalloc.c:891:27: note: 'malloc' is a builtin with type 'void *(unsigned long)'
          /home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/system/lib/dlmalloc.c:855:32: note: expanded from macro 'dlmalloc'
          #define dlmalloc               malloc
                                         ^
          /home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/system/lib/dlmalloc.c:907:27: warning: incompatible redeclaration of library function 'calloc' [-Wincompatible-library-redeclaration]
              DLMALLOC_EXPORT void* dlcalloc(size_t, size_t);
                                    ^
          /home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/system/lib/dlmalloc.c:853:32: note: expanded from macro 'dlcalloc'
          #define dlcalloc               calloc
                                         ^
          /home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/system/lib/dlmalloc.c:907:27: note: 'calloc' is a builtin with type 'void *(unsigned long, unsigned long)'
          /home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/system/lib/dlmalloc.c:853:32: note: expanded from macro 'dlcalloc'
          #define dlcalloc               calloc
                                         ^
          /home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/system/lib/dlmalloc.c:931:27: warning: incompatible redeclaration of library function 'realloc' [-Wincompatible-library-redeclaration]
              DLMALLOC_EXPORT void* dlrealloc(void*, size_t);
                                    ^
          /home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/system/lib/dlmalloc.c:858:32: note: expanded from macro 'dlrealloc'
          #define dlrealloc              realloc
                                         ^
          /home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/system/lib/dlmalloc.c:931:27: note: 'realloc' is a builtin with type 'void *(void *, unsigned long)'
          /home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/system/lib/dlmalloc.c:858:32: note: expanded from macro 'dlrealloc'
          #define dlrealloc              realloc
                                         ^
          3 warnings generated.
          opt: Unknown command line argument '-vectorize-slp-aggressive=false'.  Try: '/home/trsh/emsc/emsdk-portable/clang/e1.38.11_64bit/opt -help'
          opt: Did you mean '-vectorize-num-stores-pred=false'?
          Traceback (most recent call last):
            File "/home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/emcc", line 13, in <module>
              emcc.run()
            File "/home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/emcc.py", line 1394, in run
              shared.Building.llvm_opt(temp_file, options.llvm_opts, new_temp_file)
            File "/home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/tools/shared.py", line 1953, in llvm_opt
              proc = run_process([LLVM_OPT] + inputs + opts + ['-o', target], stdout=PIPE)
            File "/home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/tools/shared.py", line 223, in run_process
              return run_base(cmd, universal_newlines=universal_newlines, check=check, *args, **kw)
            File "/home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/tools/shared.py", line 219, in run_base
              result.check_returncode()
            File "/home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/tools/shared.py", line 206, in check_returncode
              raise Py2CalledProcessError(returncode=self.returncode, cmd=self.args, output=self.stdout, stderr=self.stderr)
          tools.shared.Py2CalledProcessError: Command '['/home/trsh/emsc/emsdk-portable/clang/e1.38.11_64bit/opt', '/tmp/tmpnUuqfN/dlmalloc_debug.bc', '-O3', '-disable-loop-vectorization', '-disable-slp-vectorization', '-vectorize-loops=false', '-vectorize-slp=false', '-vectorize-slp-aggressive=false', '-o', '/tmp/tmp6nXu99/dlmalloc_debug_0.o']' returned non-zero exit status 1
          ERROR:root:'/usr/bin/python /home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/emcc /home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/system/lib/dlmalloc.c -o /tmp/tmpnUuqfN/dlmalloc_debug.bc -O2 -DDLMALLOC_DEBUG' failed
          Traceback (most recent call last):
            File "/home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/emcc", line 13, in <module>
              emcc.run()
            File "/home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/emcc.py", line 1455, in run
              extra_files_to_link += system_libs.calculate([f for _, f in sorted(temp_files)] + extra_files_to_link, in_temp, stdout_=None, stderr_=None, forced=forced_stdlibs)
            File "/home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/tools/system_libs.py", line 499, in calculate
              libfile = shared.Cache.get(name, do_create, extension=suffix)
            File "/home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/tools/cache.py", line 101, in get
              temp = creator()
            File "/home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/tools/system_libs.py", line 497, in do_create
              ret = create(name)
            File "/home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/tools/system_libs.py", line 314, in create_dlmalloc
              check_call([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', 'dlmalloc.c'), '-o', o] + cflags)
            File "/home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/tools/shared.py", line 247, in check_call
              subprocess.check_call(cmd, *args, **kw)
            File "/usr/lib/python2.7/subprocess.py", line 186, in check_call
              raise CalledProcessError(retcode, cmd)
          subprocess.CalledProcessError: Command '['/usr/bin/python', '/home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/emcc', '/home/trsh/.local/share/cargo-web/emscripten/x86_64-unknown-linux-gnu/emscripten/system/lib/dlmalloc.c', '-o', '/tmp/tmpnUuqfN/dlmalloc_debug.bc', '-O2', '-DDLMALLOC_DEBUG']' returned non-zero exit status 1
example

All 10 comments

Really. 7 days and Nobady :(

Instead of using emscripten, does building for the wasm target work? Try:

cargo web build --target=wasm32-unknown-unknown

I have the same issue.
Can confirm that running cargo web start --target=wasm32-unknown-unknown works.
It issues some warnings about debug builds being broken and forcing a release build, but it works.

Seems similar to #412 .
It appears to be a version mismatch with your version of emscripten 1.38.11. Maybe try using the bundled version of 1.37.27-1 at the time of writing. can check it roughly here: https://github.com/koute/cargo-web/blob/master/src/emscripten.rs

Also maybe check cargo-web on other projects to see if anything deeper could be the issue?

@superlou

error[E0432]: unresolved import stdweb_internal_macros
--> /home/trsh/.cargo/registry/src/github.com-1ecc6299db9ec823/stdweb-0.4.10/src/lib.rs:141:9
|
141 | pub use stdweb_internal_macros::js_export;
| ^^^^^^^^^^^^^^^^^^^^^^ Maybe a missing extern crate stdweb_internal_macros;?
error[E0554]: #![feature] may not be used on the stable release channel
--> /home/trsh/.cargo/registry/src/github.com-1ecc6299db9ec823/stdweb-0.4.10/src/lib.rs:115:5
|
115 | / feature(use_extern_macros)
116 | | )]
| |_^
error: aborting due to 2 previous errors

@trsh what version of rust are you using?

 error[E0554]: #![feature] may not be used on the stable release channel

Consider trying the latest nightly.

@jamartin9 what then would build command look like?

@trsh the command could vary on your setup but the previous error message suggests you are using the stable branch of rust where the feature gates are not available.
Assuming you are using rustup for managing your rust toolchains:

rustup run nightly cargo web build --target=wasm32-unknown-unknown

To save on verbosity you can just set the default to nightly with rustup too(rustup default nightly).

for me also fails all following options

// in yew/examples/dashboard
cargo web start 
cargo web start --target=asmjs-unknown-emscripten
cargo web start --target=wasm32-unknown-unknown

results in smth like

warning: debug builds on the wasm32-unknown-unknown are currently totally broken
         forcing a release build
   Compiling proc-macro2 v0.4.24
   Compiling semver-parser v0.7.0
   Compiling unicode-xid v0.1.0
   Compiling ryu v0.2.7
   Compiling serde v1.0.80
   Compiling stdweb-internal-runtime v0.1.2
   Compiling failure_derive v0.1.3
   Compiling itoa v0.4.3
   Compiling base-x v0.2.3
   Compiling byteorder v1.2.7
   Compiling iovec v0.1.2
   Compiling rustc-demangle v0.1.9
   Compiling cfg-if v0.1.6
   Compiling fnv v1.0.6
error[E0463]: can't find crate for `std`
  |
  = note: the `wasm32-unknown-unknown` target may not be installed

error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
error: Could not compile `iovec`.
warning: build failed, waiting for other jobs to finish...
error[E0463]: can't find crate for `std`
  |
  = note: the `wasm32-unknown-unknown` target may not be installed
...

@shershen08, try to run rustup target add wasm32-unknown-unknown as written in readme

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  5Comments

sanpii picture sanpii  路  3Comments

Boscop picture Boscop  路  4Comments

zethra picture zethra  路  5Comments

DenisKolodin picture DenisKolodin  路  5Comments