yewstack / yew

Rust / Wasm framework for creating reliable and efficient web applications
https://yew.rs
Apache License 2.0
30.9k stars 1.43k forks source link

Having problem compiling yew #633

Closed laiboonh closed 5 years ago

laiboonh commented 5 years ago

I am using yew 0.8.0. I was previously using 0.7.0 happily but failed to compile after doing a rustup update. Not sure if anyone else have similar experience.

pii (master) $ cargo --version
cargo 1.37.0 (9edd08916 2019-08-02)
pii (master) $ rustup --version
rustup 1.18.3 (435397f48 2019-05-22)
pii (master) $ rustc --version
rustc 1.37.0 (eae3437df 2019-08-13)

Error log

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-m64" "-L" "/Users/laiboonhui/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.12c75id9a33t8g91.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.1cwqsilvvofhzq5j.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.1q7skjywk3j5dvic.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.1s8jtc82g0368as2.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.1wrky8wprwm3ed3h.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.21fwgb415w78p52r.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.21osrcwdzcor8s5n.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.21pzrfmdxdmupqfv.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.23n1gw5hidnw7iyr.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.2da6a9p4nvbfkcvw.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.2hk6vvar9wxgj0w3.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.2kftc41rz5rcepc.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.2pvb4jerxy1kl1tz.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.3i9f6xh40zp12zda.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.3lbyrh2vjmmzyvyn.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.4dfiqsif558b4tb7.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.4h08spug745dvo06.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.4jpg8ftxcvysggrf.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.4ozzkw2bve1pva3u.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.4ppyk1w86t62z7gr.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.4sgc6ui8buz118r9.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.4wyet5m8jenplp3s.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.5aj7ayeq2ux2qb0k.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.971idinrkmr15pt.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.ad4zln30tdp80rz.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.cffxvopafj09kc.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.mhfl0f5p9sv4s6i.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.s5jfobqd6ot0lsr.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.v4ybv2n9ou3e42l.rcgu.o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.x3w4mrjfeo07451.rcgu.o" "-o" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/pii_yew-2ecddda13a926cd1.387c65fma9huuxx0.rcgu.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/laiboonhui/learn/rust/pii/target/debug/deps" "-L" "/Users/laiboonhui/learn/rust/pii/target/debug/build/backtrace-sys-3dc6762d8c75f618/out" "-L" "/Users/laiboonhui/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libpii_yew-f95e2739cda5bc82.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libyew-b104b9bc83cd2cdc.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libproc_macro_nested-d246a40ddd0f7e3a.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libindexmap-9cd2e53ac68a734c.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libhttp-dba50d02a14615a2.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libfnv-6913f66909776b39.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libbytes-4aed63634a01f91f.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libiovec-9a95518c818336c5.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libstdweb-eb147c1f799dbbcc.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libdiscard-529d010a69b48ddb.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libstdweb_internal_runtime-9d44bc065e83ee63.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libserde_json-bda9e8a732394f85.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libryu-6572aa138ed68df9.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libitoa-8ac455a8eb8c9959.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libslab-7c9cf913f6ed8f97.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/liblog-33c22466c4f7b128.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libbincode-e33f2e541a6d2bdb.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libbyteorder-3d21a04fce4946bb.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libanymap-826cad8cd85261b4.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libfailure-db807006e2d8df70.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libbacktrace-987ee67bcbd89d3e.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libbacktrace_sys-d48ef3825bee36e7.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libcfg_if-f1739919c28d536c.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/librustc_demangle-37f9d53cbd993d2c.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libcore-f5d621c9bf6b4a3d.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libstrum-6a33ea0e5c915fb1.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libuuid-685aefaa3373c8a7.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/librand-4d471acfe7181d40.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/librand_xorshift-0ab6abd96312027b.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/librand_pcg-54abbb01acb79d73.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/librand_hc-ee38cbf43c3ca5a0.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/librand_chacha-b0afd83098277073.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/librand_isaac-aacbb406985bcb31.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/librand_core-526b88f02de4ef24.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/librand_os-bade14429ab73dcf.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/librand_jitter-a4e97c728f75c619.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/liblibc-591a086e6537feda.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/librand_core-066483fc939c4acb.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/librust_decimal-f4af00a71f2e920b.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libnum-f733d5e3d9059b9f.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libnum_rational-34e1908670dc6a25.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libnum_iter-5ea1a57c8453c781.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libnum_complex-f1294fd5ec00c134.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libnum_bigint-b62770caa69376ef.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libnum_integer-95eadf4322eb3317.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libnum_traits-490da9e72f41caa6.rlib" "/Users/laiboonhui/learn/rust/pii/target/debug/deps/libserde-56f51c5effe67746.rlib" "/Users/laiboonhui/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-5e90982888f9507c.rlib" "/Users/laiboonhui/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-410f3ab1892beee7.rlib" "/Users/laiboonhui/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libbacktrace-7a639c8f7495e973.rlib" "/Users/laiboonhui/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libbacktrace_sys-5d086cb0847593b8.rlib" "/Users/laiboonhui/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-cd17674ab2d2ce45.rlib" "/Users/laiboonhui/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-010a08f18b893321.rlib" "/Users/laiboonhui/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-1ce959d24e9e6203.rlib" "/Users/laiboonhui/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-db9c1b479c1cc5c0.rlib" "/Users/laiboonhui/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-58133c9a028e2f46.rlib" "/Users/laiboonhui/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-55ac4b6db4bea179.rlib" "/Users/laiboonhui/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-828d50ac17bf462d.rlib" "/Users/laiboonhui/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-2008b881092496f5.rlib" "/Users/laiboonhui/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-c690f74ce7f995eb.rlib" "/Users/laiboonhui/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-ff65685401bab2d1.rlib" "-framework" "Security" "-lSystem" "-lresolv" "-lc" "-lm"
  = note: Undefined symbols for architecture x86_64:
            "_emscripten_pause_main_loop", referenced from:
                stdweb::webcore::ffi::emscripten::event_loop::hcdb46e27768f958e in libstdweb-eb147c1f799dbbcc.rlib(stdweb-eb147c1f799dbbcc.stdweb.c7x3yl08-cgu.7.rcgu.o)
            "_emscripten_set_main_loop", referenced from:
                stdweb::webcore::ffi::emscripten::event_loop::hcdb46e27768f958e in libstdweb-eb147c1f799dbbcc.rlib(stdweb-eb147c1f799dbbcc.stdweb.c7x3yl08-cgu.7.rcgu.o)
            "_emscripten_asm_const_int", referenced from:
                yew::virtual_dom::vtag::VTag$LT$COMP$GT$::apply_diffs::snippet::__cargo_web_snippet_0da47658267a7497de743e1b0892f992ba6ca6ef::h0df04163cc425b62 in libyew-b104b9bc83cd2cdc.rlib(yew-b104b9bc83cd2cdc.yew.1ln86tv3-cgu.11.rcgu.o)
                yew::virtual_dom::vtag::VTag$LT$COMP$GT$::apply_diffs::snippet::__cargo_web_snippet_6a77b2f2accec26fefbfa0d864061d26f40f8f6f::h08a6076070435e20 in libyew-b104b9bc83cd2cdc.rlib(yew-b104b9bc83cd2cdc.yew.1ln86tv3-cgu.11.rcgu.o)
                yew::virtual_dom::vtag::set_attribute::snippet::__cargo_web_snippet_da2febd72f9938d90bc2bf2905643f595b07abd9::h266a78ceb8cfcd29 in libyew-b104b9bc83cd2cdc.rlib(yew-b104b9bc83cd2cdc.yew.1ln86tv3-cgu.11.rcgu.o)
                yew::virtual_dom::vtag::remove_attribute::snippet::__cargo_web_snippet_f6358c198ebcc61c9da370cca2679c0b8bc81a7b::h4a1453c9284bef4b in libyew-b104b9bc83cd2cdc.rlib(yew-b104b9bc83cd2cdc.yew.1ln86tv3-cgu.11.rcgu.o)
                yew::virtual_dom::vtag::set_checked::snippet::__cargo_web_snippet_a1f43b583e011a9bbeae64030b81f677e6c29005::h21c4cd4ccc0a0cbc in libyew-b104b9bc83cd2cdc.rlib(yew-b104b9bc83cd2cdc.yew.1ln86tv3-cgu.11.rcgu.o)
                _$LT$stdweb..webcore..newtype..Newtype$LT$$LP$stdweb..webcore..serialization..FunctionTag$C$$u20$$LP$A12$C$$RP$$RP$$C$stdweb..webcore..mutfn..Mut$LT$F$GT$$GT$$u20$as$u20$stdweb..webcore..serialization..FuncallAdapter$LT$F$GT$$GT$::funcall_adapter::snippet::__cargo_web_snippet_ff5103e6cc179d13b4c7a785bdce2708fd559fc0::hd15f584e29146948 in libstdweb-eb147c1f799dbbcc.rlib(stdweb-eb147c1f799dbbcc.stdweb.c7x3yl08-cgu.11.rcgu.o)
                _$LT$stdweb..webapi..html_elements..input..InputElement$u20$as$u20$stdweb..webcore..instance_of..InstanceOf$GT$::instance_of::snippet::__cargo_web_snippet_cb392b71162553130760deeb3964fa828c078f74::h83dabe56a7db294a in libstdweb-eb147c1f799dbbcc.rlib(stdweb-eb147c1f799dbbcc.stdweb.c7x3yl08-cgu.12.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)
ghost commented 5 years ago

+1 Encountered same problem just now. Tried running the "minimal" example with cargo run, got the exact same error output.

hgzimmerman commented 5 years ago

What looks like what happened here is that you are trying to build with the stable-x86_64-apple-darwin target and it can't find references to emscripten because they don't exist in that target. Specifying --target wasm32-unknown-unknown might fix your problem (assuming you want to build a wasm file).

Alternatively, as a quick fix, you could also try using cargo web start (which defaults to wasm32-unknown-unknown target). That build method is known to work reliably.

jstarry commented 5 years ago

Thanks @hgzimmerman! Feel free to re-open if the issue persists with @hgzimmerman's suggestion