Pass -Zlink-native-libraries=no when building Rust (#2753)

This commit is contained in:
Hood Chatham 2022-06-20 23:21:33 -07:00 committed by GitHub
parent d80f702a7e
commit be331255f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 26 deletions

View File

@ -149,14 +149,15 @@ export STDLIB_MODULE_CFLAGS= $(SIDE_MODULE_CFLAGS) -I Include/ -I .
# For RUST
export CARGO_HOME ?= $(HOME)/.cargo
export CARGO_BUILD_TARGET=wasm32-unknown-emscripten
export CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_LINKER=$(PYODIDE_ROOT)/tools/rust_emcc_wrapper.py
export CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_LINKER=emcc
export PYO3_CONFIG_FILE=$(PYODIDE_ROOT)/tools/pyo3_config.ini
# idealy we could automatically include all SIDE_MODULE_LDFLAGS here
export RUSTFLAGS= \
-C relocation-model=pic \
-C link-arg=-sSIDE_MODULE=2 \
-C link-arg=-sWASM_BIGINT
-C link-arg=-sWASM_BIGINT \
-Z link-native-libraries=no
.output_vars:
set

View File

@ -152,7 +152,6 @@ def get_bash_runner():
"WASM_PKG_CONFIG_PATH",
"CARGO_BUILD_TARGET",
"CARGO_HOME",
"CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_LINKER",
"RUSTFLAGS",
"PYO3_CONFIG_FILE",
]

View File

@ -1,23 +0,0 @@
#!/usr/bin/env python3
import subprocess
import sys
def update_args(args):
# remove -lc. Not sure if it makes a difference but -lc doesn't belong here.
# https://github.com/emscripten-core/emscripten/issues/17191
for i in reversed(range(len(args))):
if args[i] == "c" and args[i - 1] == "-l":
del args[i - 1 : i + 1]
return args
def main(args):
args = update_args(args)
return subprocess.call(["emcc"] + args)
if __name__ == "__main__":
args = sys.argv[1:]
sys.exit(main(args))