FIX Use response file for EXPORTED_FUNCTIONS (#4717)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
This commit is contained in:
Gyeongjae Choi 2024-04-30 18:36:39 +09:00 committed by GitHub
parent 0e23252426
commit d5fdf22aff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 3 deletions

View File

@ -16,6 +16,9 @@ myst:
## Unreleased
- {{ Fix }} pyodide-build now use response file when passing list of exported symbols to `emcc`.
This Fixes "Argument list too long" error.
- {{ Fix }} Pass through `-E` (command mode) arguments in CMake wrapper {pr}`4705`.
- {{ Fix }} Fix exception handling in dynamic linking of int64 functions {pr}`4698`.

View File

@ -11,7 +11,7 @@ source:
build:
script: |
export CMAKE_ARGS="${CMAKE_ARGS} -DEMSCRIPTEN=1"
exports: whole_archive
exports: requested
requirements:
run:

View File

@ -6,7 +6,7 @@ source:
sha256: 006f5784a9bcee43e5a7e943dc4f02de1ba2ee7a7af1ee5f190d383f3b6c9ebe
build:
backend-flags: cmake.define.USE_OPENMP=OFF
exports: whole_archive # FIXME: using "requested" fails with SIGKILL, not sure why
exports: requested
requirements:
run:
- numpy

View File

@ -427,8 +427,16 @@ def get_export_flags(
export_list = calculate_exports(line, exports == "requested")
else:
export_list = exports
prefixed_exports = ["_" + x for x in export_list]
yield f"-sEXPORTED_FUNCTIONS={prefixed_exports!r}"
import tempfile
with tempfile.NamedTemporaryFile(mode="w", delete=False) as f:
# Use a response file to avoid command line length limits
f.write(json.dumps(prefixed_exports))
yield f"-sEXPORTED_FUNCTIONS=@{f.name}"
def handle_command_generate_args( # noqa: C901