From 9fb8391c7e6b9f36f45a1448e49597f899cce29d Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Thu, 6 Jan 2022 09:40:39 -0800 Subject: [PATCH 7/8] Disable whole-archive when linking rust Rust .rlib archives contain an extra metadata file called lib.rmeta. Emscripten sets `--whole-archive` by default if LINKABLE is set. But with `--whole-archive` the linker crashes with an error due to the extra files. This disables the problematic `--whole-archive` setting when we are linking rust. See emscripten issue: https://github.com/emscripten-core/emscripten/issues/17109 --- tools/building.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/building.py b/tools/building.py index 512561c69..d180993a1 100644 --- a/tools/building.py +++ b/tools/building.py @@ -443,7 +443,7 @@ def link_lld(args, target, external_symbols=None): # Emscripten currently expects linkable output (SIDE_MODULE/MAIN_MODULE) to # include all archive contents. - if settings.LINKABLE: + if settings.LINKABLE and not any(arg.endswith(".rlib") for arg in args): args.insert(0, '--whole-archive') args.append('--no-whole-archive') -- 2.25.1