Skip to content

Commit

Permalink
Add workaround for missing __gxx_personality_v0 symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
lopopolo committed Nov 18, 2021
1 parent 688efdc commit 59267ca
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions scripts/build-wasm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ module Build

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

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

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

if verbose
`cargo build --target wasm32-unknown-emscripten --release --verbose`
Expand Down

0 comments on commit 59267ca

Please # to comment.