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

Compilation in release mode fails on latest nightly #3

Closed
jeffesquivels opened this issue Mar 22, 2023 · 4 comments · Fixed by #5
Closed

Compilation in release mode fails on latest nightly #3

jeffesquivels opened this issue Mar 22, 2023 · 4 comments · Fixed by #5

Comments

@jeffesquivels
Copy link

Hi!

Compilation of wasm-bindgen-derive fails on nightly version rustc 1.70.0-nightly (1db9c061d 2023-03-21):

$ cargo  +nightly build --release
...

error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/jeffrey/.nvm/versions/node/v18.15.0/bin:/home/jeffrey/.cargo/bin:/home/jeffrey/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:" VSLANG="1033" "cc" "-Wl,--version-script=/tmp/rustc6DsfAi/list" "-Wl,--no-undefined-version" "-m64" "/tmp/rustc6DsfAi/symbols.o" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/wasm_bindgen_derive-78c8e164a7eb1ce9.wasm_bindgen_derive.f7ce1280-cgu.0.rcgu.o" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/wasm_bindgen_derive-78c8e164a7eb1ce9.wasm_bindgen_derive.f7ce1280-cgu.1.rcgu.o" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/wasm_bindgen_derive-78c8e164a7eb1ce9.wasm_bindgen_derive.f7ce1280-cgu.10.rcgu.o" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/wasm_bindgen_derive-78c8e164a7eb1ce9.wasm_bindgen_derive.f7ce1280-cgu.11.rcgu.o" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/wasm_bindgen_derive-78c8e164a7eb1ce9.wasm_bindgen_derive.f7ce1280-cgu.12.rcgu.o" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/wasm_bindgen_derive-78c8e164a7eb1ce9.wasm_bindgen_derive.f7ce1280-cgu.13.rcgu.o" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/wasm_bindgen_derive-78c8e164a7eb1ce9.wasm_bindgen_derive.f7ce1280-cgu.14.rcgu.o" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/wasm_bindgen_derive-78c8e164a7eb1ce9.wasm_bindgen_derive.f7ce1280-cgu.15.rcgu.o" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/wasm_bindgen_derive-78c8e164a7eb1ce9.wasm_bindgen_derive.f7ce1280-cgu.2.rcgu.o" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/wasm_bindgen_derive-78c8e164a7eb1ce9.wasm_bindgen_derive.f7ce1280-cgu.3.rcgu.o" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/wasm_bindgen_derive-78c8e164a7eb1ce9.wasm_bindgen_derive.f7ce1280-cgu.4.rcgu.o" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/wasm_bindgen_derive-78c8e164a7eb1ce9.wasm_bindgen_derive.f7ce1280-cgu.5.rcgu.o" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/wasm_bindgen_derive-78c8e164a7eb1ce9.wasm_bindgen_derive.f7ce1280-cgu.6.rcgu.o" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/wasm_bindgen_derive-78c8e164a7eb1ce9.wasm_bindgen_derive.f7ce1280-cgu.7.rcgu.o" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/wasm_bindgen_derive-78c8e164a7eb1ce9.wasm_bindgen_derive.f7ce1280-cgu.8.rcgu.o" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/wasm_bindgen_derive-78c8e164a7eb1ce9.wasm_bindgen_derive.f7ce1280-cgu.9.rcgu.o" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/wasm_bindgen_derive-78c8e164a7eb1ce9.17c8ee6oayfxc45z.rcgu.rmeta" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/wasm_bindgen_derive-78c8e164a7eb1ce9.2zu6pn6bfu33a1wy.rcgu.o" "-Wl,--as-needed" "-L" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps" "-L" "/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/libjs_sys-4aeb3196566c7722.rlib" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/libwasm_bindgen-75903fcd8cdd4143.rlib" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/libcfg_if-017df4c2d4b73aea.rlib" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/libsyn-9745dd5589fda65f.rlib" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/libquote-b1a22a7d42f9a76a.rlib" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/libproc_macro2-b65ced9cda52fd74.rlib" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/libunicode_ident-eaa392664928d4f9.rlib" "/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libproc_macro-f3e505f6e0fe495a.rlib" "/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-8c5537594e196f18.rlib" "/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-62f45bff484152d4.rlib" "/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-05da49d3cca73bff.rlib" "/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-616c9bd2710f0982.rlib" "/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-d9df84ec1a8a7a8f.rlib" "/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-0242ef3eea1e9db2.rlib" "/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-127f477a16f3f8f8.rlib" "/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-18a1148b43c51528.rlib" "/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-c5f20f2274212453.rlib" "/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-4483c8bc4648568f.rlib" "/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-94da6a76998341a3.rlib" "/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-22a9646e8f27a6e4.rlib" "/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-c9ee17ad302be816.rlib" "/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-323da837c64ef472.rlib" "/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-c165d64169f217c3.rlib" "/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-8212dcd77adfe144.rlib" "/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-522518611024dce5.rlib" "/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-05898138a596088a.rlib" "/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-b78d27aa9e5e005b.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/jeffrey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/jeffrey/tmp/wasm-bindgen-derive/target/release/deps/libwasm_bindgen_derive-78c8e164a7eb1ce9.so" "-Wl,--gc-sections" "-shared" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs"
  = note: /usr/bin/ld: __wbindgen_realloc: undefined version: 
          /usr/bin/ld: __wbindgen_malloc: undefined version: 
          /usr/bin/ld: __wbindgen_free: undefined version: 
          /usr/bin/ld: __wbindgen_exn_store: undefined version: 
          /usr/bin/ld: __externref_table_dealloc: undefined version: 
          /usr/bin/ld: __externref_table_alloc: undefined version: 
          /usr/bin/ld: __externref_heap_live_count: undefined version: 
          /usr/bin/ld: __externref_drop_slice: undefined version: 
          /usr/bin/ld: failed to set dynamic section sizes: bad value
          collect2: error: ld returned 1 exit status
          

error: could not compile `wasm-bindgen-derive` (lib) due to previous error
@jeffesquivels jeffesquivels changed the title Compilation fails on latest nightly Compilation in release mode fails on latest nightly Mar 22, 2023
@fjarri
Copy link
Owner

fjarri commented Mar 22, 2023

Strange, works for me (same nightly version, but ARM64 platform). The crate itself shouldn't cause this; can you compile anything else that uses wasm-bindgen and js-sys?

@piotr-roslaniec
Copy link

piotr-roslaniec commented Jun 2, 2023

I was able to reproduce it with both nightly and stable:

# nightly-x86_64-unknown-linux-gnu updated - rustc 1.72.0-nightly (d59363ad0 2023-06-01) (from rustc 1.69.0-nightly (e972bc808 2023-01-29))

$ cargo +nightly build --release
# ...
  = note: /usr/bin/ld: __wbindgen_realloc: undefined version: 
        /usr/bin/ld: __wbindgen_malloc: undefined version: 
        /usr/bin/ld: __wbindgen_free: undefined version: 
        /usr/bin/ld: __wbindgen_exn_store: undefined version: 
        /usr/bin/ld: __externref_table_dealloc: undefined version: 
        /usr/bin/ld: __externref_table_alloc: undefined version: 
        /usr/bin/ld: __externref_heap_live_count: undefined version: 
        /usr/bin/ld: __externref_drop_slice: undefined version: 
        /usr/bin/ld: failed to set dynamic section sizes: bad value
        collect2: error: ld returned 1 exit status
        

error: could not compile `wasm-bindgen-derive` (lib) due to previous error
# stable-x86_64-unknown-linux-gnu updated - rustc 1.70.0 (90c541806 2023-05-31) (from rustc 1.66.1 (90743e729 2023-01-10))

$ cargo build --release
# ...
  = note: /usr/bin/ld: __wbindgen_realloc: undefined version: 
        /usr/bin/ld: __wbindgen_malloc: undefined version: 
        /usr/bin/ld: __wbindgen_free: undefined version: 
        /usr/bin/ld: __wbindgen_exn_store: undefined version: 
        /usr/bin/ld: __externref_table_dealloc: undefined version: 
        /usr/bin/ld: __externref_table_alloc: undefined version: 
        /usr/bin/ld: __externref_heap_live_count: undefined version: 
        /usr/bin/ld: __externref_drop_slice: undefined version: 
        /usr/bin/ld: failed to set dynamic section sizes: bad value
        collect2: error: ld returned 1 exit status
        

error: could not compile `wasm-bindgen-derive` (lib) due to previous error

I was able to compile on stable just fine, but then I ran rustup update and updated it from 1.66 to 1.70. After that I was able to reproduce the error on stable.

This error is also showing up on stable in our CI pipeline

piotr-roslaniec added a commit to piotr-roslaniec/wasm-bindgen-derive that referenced this issue Jun 2, 2023
@piotr-roslaniec
Copy link

I've reproduced this issue & added a temporary workaround in this PR: #4

The root cause seems to be the stripping of certain WASM symbols (?) during optimization steps mandated by the --release flag.

@fjarri
Copy link
Owner

fjarri commented Jun 2, 2023

Filed rustwasm/wasm-bindgen#3457

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants