Wasm-bindgen: Duplicate symbol linker errors when doing `cargo test -p js-sys --target wasm32-unknown-unknown`

Created on 25 Jul 2018  路  11Comments  路  Source: rustwasm/wasm-bindgen

On latest rust nightly and master wasm-bindgen, if I try to run the new wasm test runner, I get this:

$ cargo test -p js-sys --target wasm32-unknown-unknown
   Compiling js-sys v0.2.14 (file:///home/fitzgen/wasm-bindgen/crates/js-sys)
   Compiling wasm-bindgen-test v0.2.14 (file:///home/fitzgen/wasm-bindgen/crates/test)
error: linking with `rust-lld` failed: exit code: 1
  |
  = note: "rust-lld" "-flavor" "wasm" "-L" "/home/fitzgen/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.1004il2fld57xk4.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.10sgy0d0ee6wxype.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.13p994nx9zee386o.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.146dmntj33rr51h.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.14cu8eabm5f78vzt.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.16i0u6jlhoj1fwbo.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.16skgpw04fge4vir.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.16u6js6g0l3k1ic6.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.181cuta0v63atwcm.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.1dqvxks6k2bzkxe.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.1fvo7xd3g7ddepia.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.1gr0u09uk9q57qqg.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.1im38lueib99jsk0.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.1jnlhyxj59jycbjv.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.1k3iwgkctxupt638.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.1m9795n1ot0eo1gs.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.1nyfdlp3jd783n7g.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.1o6b1la7g4jnv39b.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.1q8ffos2d96smbjs.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.1rmm85xvb873qftb.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.1u3pi6gj5d1em22j.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.1xr8khka4dhjadue.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.1y16o1qfye96o7m0.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.1zwd8n7bcl3vhvvh.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.20szwgeugljl28ms.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.23tqyymcb18u96mb.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.2imnh2vhxcqrizhm.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.2jqywn86b2gsqohu.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.2lyh15q6cjwzy18c.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.2q5257pdh5222n7q.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.2qm7huv9f1lg6lu9.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.2uvxlfgwpem1x20l.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.2vj00whefmtysknz.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.2xs38k3nu4oe9uo6.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.38ps4pa181wsnsy9.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.3ayaeypdcro9d6yk.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.3c0eapghx17gqjor.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.3ciwxwykcqc2al21.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.3fetdu25kzrqhs1x.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.3gen0i5iqxdz5ezf.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.3ldk0i2zxftngav8.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.3o9nx3yphver8p13.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.3ogiytm5zrtd1avj.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.3qelh4zl72rd9kcr.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.3rngp6bm2u2q5z0y.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.3rrt9fvj3f0up53h.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.3xpdid6in6rag614.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.3ydgopwvxsv8ob7w.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.43id8woyuc2uo2lf.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.43v6g0y2xsxoggnt.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.45pc7c65foh9i35f.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.47bdichgt2rw6m42.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.47kb80rpg37n2ote.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.48721dc4k5qxei0u.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.49a7n47po4ttqjl7.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.49lx1q7cxvpykyv0.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.4g57xz0h27ffnjq0.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.4kioah7cfvm2ji51.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.4kp5s9g5d9c5xr5x.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.4oc10dk278mpk1vy.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.4s62sj8vor6hko2.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.4xq48u46a1pwiqn7.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.4y33imnjf0v64y8p.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.4yh8x2b62dcih00t.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.4ypvbwho0bu5tnww.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.51s1w397y42gpez1.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.54jljjd4ae06wvua.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.5544xgl7axh7p8nz.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.57k06xfugllsc526.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.59grhtdkhyfhzvtn.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.5ddv3aeh7sj1b0iu.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.5eh9owxygv593uap.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.5eu5ie0s1n0lbbrq.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.7p53qlves2rwxx0.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.81jpvh8cn5k8ng8.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.85b3po7him5ai8f.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.8xzrsc1ux72v29j.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.98g0d9x8aw3akpe.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.9elsx31vb4it187.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.9fcb3syd3ne5k0n.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.c35miryxnk5pfrl.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.c6lbtaiefvx3wya.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.caly39r61nmw51h.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.d9mr71izyv057u1.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.doar5ife0jn9b6h.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.dqfv90oxfxri5ga.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.e7a9n9ijpj8m85c.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.iptwr7a8krsul7z.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.k8vy1kwhc51sg46.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.od4h755bu4dun30.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.qjshafan2tzexed.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.sjcqfz2ncn1dupz.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.y08g5q2x813c4wx.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.y17wv1ax8ofetec.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.z2z4yh9t6sy3yv6.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.z9ox7biyn1otfln.rcgu.o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.ze3nouw7s0joi32.rcgu.o" "-o" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.wasm" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/wasm-dbeba06dda662d58.crate.allocator.rcgu.o" "--gc-sections" "-O0" "-L" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps" "-L" "/home/fitzgen/wasm-bindgen/target/debug/deps" "-L" "/home/fitzgen/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib" "/home/fitzgen/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libtest-cd2e845f4c70927d.rlib" "/home/fitzgen/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libterm-9eb611101cf4cecf.rlib" "/home/fitzgen/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libgetopts-4874943d5732d1b7.rlib" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/libwasm_bindgen_test-91b21e13fad03ba1.rlib" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/libconsole_error_panic_hook-7ceda4b777d3369f.rlib" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/libwasm_bindgen-2f0482620b67b3d0.rlib" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/libcfg_if-208a990cb8a1ba5a.rlib" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/libjs_sys-9ed18fb3a340f2f4.rlib" "/home/fitzgen/wasm-bindgen/target/wasm32-unknown-unknown/debug/deps/libwasm_bindgen-6c467b04716cd7b6.rlib" "/home/fitzgen/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libstd-6942f89a9ed0ae0a.rlib" "/home/fitzgen/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libpanic_unwind-a5a7585073f51dde.rlib" "/home/fitzgen/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libunwind-003f74338435e0fd.rlib" "/home/fitzgen/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/liblibc-b75d74899d2adc7f.rlib" "/home/fitzgen/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/liballoc_system-1efdabcae0bfed6a.rlib" "/home/fitzgen/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libdlmalloc-2ea6b81fa3004fb7.rlib" "/home/fitzgen/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/liballoc-8b879cd22eb4890a.rlib" "/home/fitzgen/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libcore-f30fde47d896be92.rlib" "/home/fitzgen/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libcompiler_builtins-ddc5be726ac41261.rlib" "--no-threads" "-z" "stack-size=1048576" "--stack-first" "--allow-undefined" "--no-entry"
  = note: rust-lld: error: duplicate symbol: __wbindgen_global_argument_ptr
          >>> defined in wasm_bindgen-2f0482620b67b3d0.wasm_bindgen4.rcgu.o
          >>> defined in wasm_bindgen-6c467b04716cd7b6.4kp5s9g5d9c5xr5x.rcgu.o

          rust-lld: error: duplicate symbol: __wbindgen_malloc
          >>> defined in wasm_bindgen-2f0482620b67b3d0.wasm_bindgen4.rcgu.o
          >>> defined in wasm_bindgen-6c467b04716cd7b6.4kp5s9g5d9c5xr5x.rcgu.o

          rust-lld: error: duplicate symbol: __wbindgen_free
          >>> defined in wasm_bindgen-2f0482620b67b3d0.wasm_bindgen4.rcgu.o
          >>> defined in wasm_bindgen-6c467b04716cd7b6.4kp5s9g5d9c5xr5x.rcgu.o


error: aborting due to previous error

error: Could not compile `js-sys`.

To learn more, run the command again with --verbose.

+cc @alexcrichton -- any idea what's up here?

bug js-sys

All 11 comments

Hm is this still reproducing? If so it's likely caused by this not working (a cargo update being needed)

I'm gonna close this as I think it's due to the previous comment, but can continue to dig in if it reproduces!

Quick note: I'm seeing this, using the latest nightly and wasm-bindgen from the latest git master branch. In my case I see it trying to build a small wasm project.

  = note: C:\Users\lxd\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\bin\rust-lld.exe: error: duplicate symbol: __wbindgen_global_argument_ptr
          >>> defined in wasm_bindgen-fbdfbff66de8e5e4.wasm_bindgen13.rcgu.o
          >>> defined in wasm_bindgen-1e9469516922bb5c.wasm_bindgen4.rcgu.o

          C:\Users\lxd\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\bin\rust-lld.exe: error: duplicate symbol: __wbindgen_malloc
          >>> defined in wasm_bindgen-fbdfbff66de8e5e4.wasm_bindgen13.rcgu.o
          >>> defined in wasm_bindgen-1e9469516922bb5c.wasm_bindgen4.rcgu.o

          C:\Users\lxd\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\bin\rust-lld.exe: error: duplicate symbol: __wbindgen_free
          >>> defined in wasm_bindgen-fbdfbff66de8e5e4.wasm_bindgen13.rcgu.o
          >>> defined in wasm_bindgen-1e9469516922bb5c.wasm_bindgen4.rcgu.o

This weekend I'll work on making a reproducer that I can share. But I just wanted to update this issue in the meantime.

@eminence oh dear that sounds bad! Do you know if there's two wasm-bindgen entries in your Cargo.lock?

Ahh, indeed their is:

[[package]]
name = "wasm-bindgen"
version = "0.2.15"
source = "git+https://github.com/rustwasm/wasm-bindgen#2a6d98a6c92a70a49e15d5a58ff3c9d0531c5f4c"
dependencies = [
 "wasm-bindgen-macro 0.2.15 (git+https://github.com/rustwasm/wasm-bindgen)",
]

[[package]]
name = "wasm-bindgen"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "wasm-bindgen-macro 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)",
]

Ah ok, that'd definitely cause problems! Do you know what's introducing the git dependency in your build? (or maybe you're using git but a different crate is using crates.io?)

it's probably the console_error_panic_hook crate, which has a wasm-bindgen dependency.

This is my project's dependencies:

[dependencies]
wasm-bindgen = {git="https://github.com/rustwasm/wasm-bindgen"}
web-sys = {git="https://github.com/rustwasm/wasm-bindgen"}
console_error_panic_hook = "0.1.1"    # A panic hook for `wasm32-unknown-unknown` that logs panics to `console.error`

If I remove the console_error_panic_hook dependency, everything links OK. I could also work around this by adding a patch entry for wasm-bindgen:

[patch.crates-io]
wasm-bindgen = {git="https://github.com/rustwasm/wasm-bindgen"}

Ok yeah that sounds about right! I also agree that [patch] should solve the issue as well

ok great. thank you for the help @alexcrichton !

is there any chance to make these symbols weak symbols? cargo does not allow replacing one crates.io version with another, so this will be a problem in the future

@aep in https://github.com/rustwasm/wasm-bindgen/pull/772 we're making this a static error so hopefully this will come up in a more first class way in Cargo!

Was this page helpful?
0 / 5 - 0 ratings