Repository navigation
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.O-wasmTarget: WASM (WebAssembly), http://webassembly.org/Target: WASM (WebAssembly), http://webassembly.org/P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
I tried this code:
fn main() {
println!("Hello, world!");
}I expected to see this happen: Compiling with rustc --target=wasm32-unknown-emscripten main.rs , after the emsdk is activated and emcc works, to compile properly
Instead, this happened: Prints this error:
= note: error: undefined symbol: __gxx_personality_v0 (referenced by top-level compiled C/C++ code)
warning: Link with `-s LLD_REPORT_UNDEFINED` to get more information on undefined symbols
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
warning: ___gxx_personality_v0 may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
Error: Aborting compilation due to previous errors
emcc: error: 'C:/Users/camer/Documents/Tech/emsdk/node/14.15.5_64bit/bin/node.exe C:\Users\camer\Documents\Tech\emsdk\upstream\emscripten\src\compiler.js C:\Users\camer\AppData\Local\Temp\tmprxn1kc58.txt' failed (returned 1)
I've tried adding -lstdc++ to no avail
Meta
rustc --version --verbose:
rustc 1.54.0-nightly (f58631b45 2021-05-28)
binary: rustc
commit-hash: f58631b4503b5cd34163cf9c3ff19dc3e0c8a09e
commit-date: 2021-05-28
host: x86_64-pc-windows-msvc
release: 1.54.0-nightly
LLVM version: 12.0.1
Backtrace
error: linking with `emcc.bat` failed: exit code: 1
|
= note: "cmd" "/c" "emcc.bat" "-s" "DISABLE_EXCEPTION_CATCHING=0" "-L" "C:\\Users\\camer\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\wasm32-unknown-emscripten\\lib" "-L" "C:\\Users\\camer\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\wasm32-unknown-emscripten\\lib\\self-contained" "main.main.7rcbfp3g-cgu.0.rcgu.o" "main.main.7rcbfp3g-cgu.1.rcgu.o" "main.main.7rcbfp3g-cgu.2.rcgu.o" "main.main.7rcbfp3g-cgu.3.rcgu.o" "main.main.7rcbfp3g-cgu.4.rcgu.o" "main.main.7rcbfp3g-cgu.5.rcgu.o" "main.main.7rcbfp3g-cgu.6.rcgu.o" "main.main.7rcbfp3g-cgu.7.rcgu.o" "-o" "main.js" "-s" "EXPORTED_FUNCTIONS=[\"_main\",\"_rust_eh_personality\"]" "main.4s37gsrti678ik8u.rcgu.o" "-O0" "--memory-init-file" "0" "-g0" "-s" "DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=[]" "-L" "C:\\Users\\camer\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\wasm32-unknown-emscripten\\lib" "C:\\Users\\camer\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\wasm32-unknown-emscripten\\lib\\libstd-fb3d38fb81b27f3a.rlib" "C:\\Users\\camer\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\wasm32-unknown-emscripten\\lib\\libpanic_unwind-d2cae8b45410ca8e.rlib" "C:\\Users\\camer\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\wasm32-unknown-emscripten\\lib\\libstd_detect-59eadd895a0069e7.rlib" "C:\\Users\\camer\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\wasm32-unknown-emscripten\\lib\\librustc_demangle-034447b1a63c6379.rlib" "C:\\Users\\camer\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\wasm32-unknown-emscripten\\lib\\libhashbrown-3b180b71fa933791.rlib" "C:\\Users\\camer\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\wasm32-unknown-emscripten\\lib\\librustc_std_workspace_alloc-5d053d604e1da3fd.rlib" "C:\\Users\\camer\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\wasm32-unknown-emscripten\\lib\\libunwind-835bbc670368e525.rlib" "C:\\Users\\camer\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\wasm32-unknown-emscripten\\lib\\libcfg_if-8111a663608e727d.rlib" "C:\\Users\\camer\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\wasm32-unknown-emscripten\\lib\\liblibc-35dde82b6021f4d8.rlib" "C:\\Users\\camer\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\wasm32-unknown-emscripten\\lib\\liballoc-a187fd59d7a86f05.rlib" "C:\\Users\\camer\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\wasm32-unknown-emscripten\\lib\\librustc_std_workspace_core-81a0f0dbfa7b5ebf.rlib" "C:\\Users\\camer\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\wasm32-unknown-emscripten\\lib\\libcore-ced9603eedaff686.rlib" "C:\\Users\\camer\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\wasm32-unknown-emscripten\\lib\\libcompiler_builtins-2960d62a9b1d31c1.rlib" "-l" "c" "-s" "ERROR_ON_UNDEFINED_SYMBOLS=1" "-s" "ASSERTIONS=1" "-s" "ABORTING_MALLOC=0" "-Wl,--fatal-warnings"
= note: error: undefined symbol: __gxx_personality_v0 (referenced by top-level compiled C/C++ code)
warning: Link with `-s LLD_REPORT_UNDEFINED` to get more information on undefined symbols
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
warning: ___gxx_personality_v0 may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
Error: Aborting compilation due to previous errors
emcc: error: 'C:/Users/camer/Documents/Tech/emsdk/node/14.15.5_64bit/bin/node.exe C:\Users\camer\Documents\Tech\emsdk\upstream\emscripten\src\compiler.js C:\Users\camer\AppData\Local\Temp\tmp6dw5_wby.txt' failed (returned 1)
error: aborting due to previous error
Reacted by Slim and Sebastian Urban
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.O-wasmTarget: WASM (WebAssembly), http://webassembly.org/Target: WASM (WebAssembly), http://webassembly.org/P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Activity
creikey commentedon May 29, 2021
runs successfully
creikey commentedon May 30, 2021
Also is broken on ubuntu with the same error message (at least windows subsystem for linux)
[-]Emscripten compilation broken on windows [/-][+]Emscripten wasm32 compilation broken[/+]strager commentedon Jun 1, 2021
rustc 1.53.0-nightly (42816d6 2021-04-24)
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.12 (d0e647bf266caad50943e78c9841e05e9c499a5d)
Here's some info I gathered:
__gxx_personality_v0. I think Rust is assuming that this symbol comes from emscripten.__gxx_personality_wasm0git login emscripten's repo shows that cxa_personality.cpp was never compiled into libc++abi.a by tools/system_libs.py.__gxx_personality_v0has been stubbed out for 6 years and never did anything.I successfully compiled hello world with emscripten SDK version 2.0.9. That version still has the
__gxx_personality_v0stub.inquisitivecrystal commentedon Jun 5, 2021
@rustbot label I-prioritize T-compiler O-wasm
apiraino commentedon Jun 9, 2021
thanks @strager for the analysis.
Assigning priority as discussed in the Zulip thread of the Prioritization Working Group. Let's find someone who can have a look at this.
@rustbot label -I-prioritize +P-high +I-nominated
lopopolo commentedon Aug 5, 2021
I recall with the LLVM 11 upgrade, the compat notes mentioned which version of Emscripten to use when compiling with the
wasm32-unknown-emscriptentarget.https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1470-2020-10-08
Once this bug is resolved, can we add a similar note for the releases that upgrade Rust to LLVM 12?
7 remaining items
Add support for the wasm32-unknown-emscripten target
Add support for the wasm32-unknown-emscripten target
Add support for the wasm32-unknown-emscripten target
Add support for the wasm32-unknown-emscripten target
Add support for the wasm32-unknown-emscripten target
Add support for the wasm32-unknown-emscripten target
Add support for the wasm32-unknown-emscripten target
hoodmane commentedon Jun 2, 2022
Reported this on Emscripten:
emscripten-core/emscripten#17128
Don't use __gxx_personality_v0 in panic_unwind on emscripten target
Rollup merge of rust-lang#97888 - hoodmane:emscripten-eh-personality,…
Rollup merge of rust-lang#97888 - hoodmane:emscripten-eh-personality,…