Skip to content

Commit 59267ca

Browse files
committed
Add workaround for missing __gxx_personality_v0 symbol
See: - zackradisic/cheatsheets#21 (comment) - rust-lang/rust#85821 (comment)
1 parent 688efdc commit 59267ca

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

scripts/build-wasm.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ module Build
3939

4040
def self.debug(verbose: false)
4141
ENV['RUSTFLAGS'] = RUSTFLAGS.join(' ')
42+
# Rust compilation on `wasm32-unknown-emscripten` fails during linking
43+
# due to a dependency on missing symbol `__gxx_personality_v0`. This has
44+
# been broken since Rust 1.53.0 and emsdk newer than 2.0.9.
45+
#
46+
# These flags work around the problem by letting the emcc linker ignore
47+
# the missing symbol error.
48+
#
49+
# - https://github.com/zackradisic/cheatsheets/issues/21#issuecomment-969393554
50+
# - https://github.com/rust-lang/rust/issues/85821#issuecomment-969369677
51+
ENV['EMMAKEN_CFLAGS'] = '-s ERROR_ON_UNDEFINED_SYMBOLS=0 --no-entry'
4252

4353
if verbose
4454
`cargo build --target wasm32-unknown-emscripten --verbose`
@@ -57,6 +67,16 @@ def self.debug(verbose: false)
5767

5868
def self.release(verbose: false)
5969
ENV['RUSTFLAGS'] = RUSTFLAGS.join(' ')
70+
# Rust compilation on `wasm32-unknown-emscripten` fails during linking
71+
# due to a dependency on missing symbol `__gxx_personality_v0`. This has
72+
# been broken since Rust 1.53.0 and emsdk newer than 2.0.9.
73+
#
74+
# These flags work around the problem by letting the emcc linker ignore
75+
# the missing symbol error.
76+
#
77+
# - https://github.com/zackradisic/cheatsheets/issues/21#issuecomment-969393554
78+
# - https://github.com/rust-lang/rust/issues/85821#issuecomment-969369677
79+
ENV['EMMAKEN_CFLAGS'] = '-s ERROR_ON_UNDEFINED_SYMBOLS=0 --no-entry'
6080

6181
if verbose
6282
`cargo build --target wasm32-unknown-emscripten --release --verbose`

0 commit comments

Comments
 (0)