Skip to content

Emscripten builds broken on nightly? (Linking errors in fresh "hello world" crate) #66916

Closed
@elidupree

Description

@elidupree

I have the current nightly (did rustup update today), current cargo-web (0.6.26), and if I do cargo new followed by cargo web start --target=wasm32-unknown-emscripten, I get linking errors.

Same error occurs on nightly-2019-11-25. Also occurs when the target is asmjs-unknown-emscripten. The build succeeds on stable (1.39.0), and succeeds on nightly when the target is wasm32-unknown-unknown.

Example commandline output:

$ cargo web start --target=wasm32-unknown-emscripten --verbose
info: downloading component 'rust-std' for 'wasm32-unknown-emscripten'
info: installing component 'rust-std' for 'wasm32-unknown-emscripten'
   Compiling rust_emscripten_test v0.1.0 (/n/junk/rust_emscripten_test)
     Running `rustc --edition=2018 --crate-name rust_emscripten_test src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=6c74eb2532e4ce4c --out-dir /n/junk/rust_emscripten_test/target/wasm32-unknown-emscripten/debug/deps --target wasm32-unknown-emscripten -C incremental=/n/junk/rust_emscripten_test/target/wasm32-unknown-emscripten/debug/incremental -L dependency=/n/junk/rust_emscripten_test/target/wasm32-unknown-emscripten/debug/deps -L dependency=/n/junk/rust_emscripten_test/target/debug/deps --cfg cargo_web -C link-arg=-s -C link-arg=NO_EXIT_RUNTIME=1 -C link-arg=-s -C link-arg=ALLOW_MEMORY_GROWTH=1`
error: linking with `emcc` failed: exit code: 1
  |
  = note: "emcc" "-s" "DISABLE_EXCEPTION_CATCHING=0" "-L" "/n/HOME/.rustup/toolchains/nightly-2019-11-25-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib" "/n/junk/rust_emscripten_test/target/wasm32-unknown-emscripten/debug/deps/rust_emscripten_test.3effavo9onmh17hh.rcgu.o" "/n/junk/rust_emscripten_test/target/wasm32-unknown-emscripten/debug/deps/rust_emscripten_test.3jhw78ilx9rc2ys8.rcgu.o" "/n/junk/rust_emscripten_test/target/wasm32-unknown-emscripten/debug/deps/rust_emscripten_test.40bcesoxxieo28hi.rcgu.o" "/n/junk/rust_emscripten_test/target/wasm32-unknown-emscripten/debug/deps/rust_emscripten_test.43du0ixpxk05i5xw.rcgu.o" "/n/junk/rust_emscripten_test/target/wasm32-unknown-emscripten/debug/deps/rust_emscripten_test.77fq9ag17u8dhov.rcgu.o" "/n/junk/rust_emscripten_test/target/wasm32-unknown-emscripten/debug/deps/rust_emscripten_test.y2v92ehm3d15aty.rcgu.o" "-o" "/n/junk/rust_emscripten_test/target/wasm32-unknown-emscripten/debug/deps/rust_emscripten_test.js" "-s" "EXPORTED_FUNCTIONS=[\"_main\",\"_rust_eh_personality\"]" "/n/junk/rust_emscripten_test/target/wasm32-unknown-emscripten/debug/deps/rust_emscripten_test.2zo8kgta1jtd5lj3.rcgu.o" "-O0" "--memory-init-file" "0" "-g4" "-s" "DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=[]" "-L" "/n/junk/rust_emscripten_test/target/wasm32-unknown-emscripten/debug/deps" "-L" "/n/junk/rust_emscripten_test/target/debug/deps" "-L" "/n/HOME/.rustup/toolchains/nightly-2019-11-25-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib" "/n/HOME/.rustup/toolchains/nightly-2019-11-25-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/libstd-1fcfbd12280fae19.rlib" "/n/HOME/.rustup/toolchains/nightly-2019-11-25-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/libpanic_unwind-c611e0a491081e5f.rlib" "/n/HOME/.rustup/toolchains/nightly-2019-11-25-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/libhashbrown-607c8cbf81c3463a.rlib" "/n/HOME/.rustup/toolchains/nightly-2019-11-25-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/librustc_std_workspace_alloc-0cfc23cf52635c24.rlib" "/n/HOME/.rustup/toolchains/nightly-2019-11-25-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/libbacktrace-432c039f2b9d4ddc.rlib" "/n/HOME/.rustup/toolchains/nightly-2019-11-25-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/librustc_demangle-3977dea4164900ab.rlib" "/n/HOME/.rustup/toolchains/nightly-2019-11-25-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/libunwind-12a8c7fb5b3a6c42.rlib" "/n/HOME/.rustup/toolchains/nightly-2019-11-25-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/libcfg_if-43bf8ebede870373.rlib" "/n/HOME/.rustup/toolchains/nightly-2019-11-25-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/liblibc-8addec02b212c706.rlib" "/n/HOME/.rustup/toolchains/nightly-2019-11-25-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/liballoc-bd32e0e1475a4f82.rlib" "/n/HOME/.rustup/toolchains/nightly-2019-11-25-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/librustc_std_workspace_core-9de912f7a3da239b.rlib" "/n/HOME/.rustup/toolchains/nightly-2019-11-25-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/libcore-5e42171377e616dd.rlib" "/n/HOME/.rustup/toolchains/nightly-2019-11-25-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/libcompiler_builtins-9517bbf2b8ee524b.rlib" "-l" "c" "-s" "NO_EXIT_RUNTIME=1" "-s" "ALLOW_MEMORY_GROWTH=1" "-s" "ERROR_ON_UNDEFINED_SYMBOLS=1" "-s" "ASSERTIONS=1" "-s" "ABORTING_MALLOC=0" "-Wl,--fatal-warnings"
  = note: WARNING:root:/n/junk/rust_emscripten_test/target/wasm32-unknown-emscripten/debug/deps/rust_emscripten_test.3effavo9onmh17hh.rcgu.o is not valid LLVM bitcode
          WARNING:root:/n/junk/rust_emscripten_test/target/wasm32-unknown-emscripten/debug/deps/rust_emscripten_test.3jhw78ilx9rc2ys8.rcgu.o is not valid LLVM bitcode
          WARNING:root:/n/junk/rust_emscripten_test/target/wasm32-unknown-emscripten/debug/deps/rust_emscripten_test.40bcesoxxieo28hi.rcgu.o is not valid LLVM bitcode
          WARNING:root:/n/junk/rust_emscripten_test/target/wasm32-unknown-emscripten/debug/deps/rust_emscripten_test.43du0ixpxk05i5xw.rcgu.o is not valid LLVM bitcode
          WARNING:root:/n/junk/rust_emscripten_test/target/wasm32-unknown-emscripten/debug/deps/rust_emscripten_test.77fq9ag17u8dhov.rcgu.o is not valid LLVM bitcode
          WARNING:root:/n/junk/rust_emscripten_test/target/wasm32-unknown-emscripten/debug/deps/rust_emscripten_test.y2v92ehm3d15aty.rcgu.o is not valid LLVM bitcode
          WARNING:root:/n/junk/rust_emscripten_test/target/wasm32-unknown-emscripten/debug/deps/rust_emscripten_test.2zo8kgta1jtd5lj3.rcgu.o is not valid LLVM bitcode
          WARNING:root:object /tmp/emscripten_temp_dFv8u4_archive_contents/std-1fcfbd12280fae19.std.5c9ljwyk-cgu.0.rcgu.o is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_dFv8u4_archive_contents/lib.rmeta is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_dFv8u4_archive_contents/std-1fcfbd12280fae19.std.5c9ljwyk-cgu.0.rcgu.bc.z is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_cgKpQq_archive_contents/panic_unwind-c611e0a491081e5f.panic_unwind.23rlr7ip-cgu.0.rcgu.o is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_cgKpQq_archive_contents/lib.rmeta is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_cgKpQq_archive_contents/panic_unwind-c611e0a491081e5f.panic_unwind.23rlr7ip-cgu.0.rcgu.bc.z is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_SIoCtx_archive_contents/hashbrown-607c8cbf81c3463a.hashbrown.5152pmq1-cgu.0.rcgu.o is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_SIoCtx_archive_contents/lib.rmeta is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_SIoCtx_archive_contents/hashbrown-607c8cbf81c3463a.hashbrown.5152pmq1-cgu.0.rcgu.bc.z is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_wFFRHN_archive_contents/rustc_std_workspace_alloc-0cfc23cf52635c24.rustc_std_workspace_alloc.83s1ivy8-cgu.0.rcgu.o is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_wFFRHN_archive_contents/lib.rmeta is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_wFFRHN_archive_contents/rustc_std_workspace_alloc-0cfc23cf52635c24.rustc_std_workspace_alloc.83s1ivy8-cgu.0.rcgu.bc.z is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_2nPYgD_archive_contents/backtrace-432c039f2b9d4ddc.backtrace.d8lkv2lk-cgu.0.rcgu.o is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_2nPYgD_archive_contents/lib.rmeta is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_2nPYgD_archive_contents/backtrace-432c039f2b9d4ddc.backtrace.d8lkv2lk-cgu.0.rcgu.bc.z is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_o9MxQI_archive_contents/rustc_demangle-3977dea4164900ab.rustc_demangle.7xkz49id-cgu.0.rcgu.o is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_o9MxQI_archive_contents/lib.rmeta is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_o9MxQI_archive_contents/rustc_demangle-3977dea4164900ab.rustc_demangle.7xkz49id-cgu.0.rcgu.bc.z is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_lyFnCB_archive_contents/unwind-12a8c7fb5b3a6c42.unwind.9khdj4dv-cgu.0.rcgu.o is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_lyFnCB_archive_contents/lib.rmeta is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_lyFnCB_archive_contents/unwind-12a8c7fb5b3a6c42.unwind.9khdj4dv-cgu.0.rcgu.bc.z is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_93exa9_archive_contents/cfg_if-43bf8ebede870373.cfg_if.41g2jzan-cgu.0.rcgu.o is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_93exa9_archive_contents/lib.rmeta is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_93exa9_archive_contents/cfg_if-43bf8ebede870373.cfg_if.41g2jzan-cgu.0.rcgu.bc.z is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_HYmpWR_archive_contents/libc-8addec02b212c706.libc.716tw7zw-cgu.0.rcgu.o is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_HYmpWR_archive_contents/lib.rmeta is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_HYmpWR_archive_contents/libc-8addec02b212c706.libc.716tw7zw-cgu.0.rcgu.bc.z is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_0CLSbW_archive_contents/alloc-bd32e0e1475a4f82.alloc.32w6a2l7-cgu.0.rcgu.o is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_0CLSbW_archive_contents/lib.rmeta is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_0CLSbW_archive_contents/alloc-bd32e0e1475a4f82.alloc.32w6a2l7-cgu.0.rcgu.bc.z is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_rI_TbG_archive_contents/rustc_std_workspace_core-9de912f7a3da239b.rustc_std_workspace_core.6km2rhby-cgu.0.rcgu.o is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_rI_TbG_archive_contents/lib.rmeta is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_rI_TbG_archive_contents/rustc_std_workspace_core-9de912f7a3da239b.rustc_std_workspace_core.6km2rhby-cgu.0.rcgu.bc.z is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_P5Xd4R_archive_contents/core-5e42171377e616dd.core.7ijpxdtg-cgu.0.rcgu.o is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_P5Xd4R_archive_contents/lib.rmeta is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_P5Xd4R_archive_contents/core-5e42171377e616dd.core.7ijpxdtg-cgu.0.rcgu.bc.z is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_fgzoAU_archive_contents/compiler_builtins-9517bbf2b8ee524b.compiler_builtins.5ji0j36k-cgu.0.rcgu.o is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_fgzoAU_archive_contents/lib.rmeta is not valid according to llvm-nm, cannot link
          WARNING:root:object /tmp/emscripten_temp_fgzoAU_archive_contents/compiler_builtins-9517bbf2b8ee524b.compiler_builtins.5ji0j36k-cgu.0.rcgu.bc.z is not valid according to llvm-nm, cannot link
          ERROR:root:undefined exported function: "_main"
          

error: aborting due to previous error
error: could not compile `rust_emscripten_test`.

Caused by:
  process didn't exit successfully: `rustc --edition=2018 --crate-name rust_emscripten_test src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=6c74eb2532e4ce4c --out-dir /n/junk/rust_emscripten_test/target/wasm32-unknown-emscripten/debug/deps --target wasm32-unknown-emscripten -C incremental=/n/junk/rust_emscripten_test/target/wasm32-unknown-emscripten/debug/incremental -L dependency=/n/junk/rust_emscripten_test/target/wasm32-unknown-emscripten/debug/deps -L dependency=/n/junk/rust_emscripten_test/target/debug/deps --cfg cargo_web -C link-arg=-s -C link-arg=NO_EXIT_RUNTIME=1 -C link-arg=-s -C link-arg=ALLOW_MEMORY_GROWTH=1` (exit code: 1)
error: build failed

Metadata

Metadata

Assignees

Labels

A-linkageArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleO-emscriptenTarget: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL!O-wasmTarget: WASM (WebAssembly), http://webassembly.org/P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions