diff --git a/docs/project/changelog.md b/docs/project/changelog.md index 5741c18e1..0f3cb2395 100644 --- a/docs/project/changelog.md +++ b/docs/project/changelog.md @@ -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`. diff --git a/packages/awkward-cpp/meta.yaml b/packages/awkward-cpp/meta.yaml index f7296a3c7..b090a74f4 100644 --- a/packages/awkward-cpp/meta.yaml +++ b/packages/awkward-cpp/meta.yaml @@ -11,7 +11,7 @@ source: build: script: | export CMAKE_ARGS="${CMAKE_ARGS} -DEMSCRIPTEN=1" - exports: whole_archive + exports: requested requirements: run: diff --git a/packages/lightgbm/meta.yaml b/packages/lightgbm/meta.yaml index bde387114..378dc9358 100644 --- a/packages/lightgbm/meta.yaml +++ b/packages/lightgbm/meta.yaml @@ -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 diff --git a/pyodide-build/pyodide_build/pywasmcross.py b/pyodide-build/pyodide_build/pywasmcross.py index 3c77b8345..6d8a1a383 100755 --- a/pyodide-build/pyodide_build/pywasmcross.py +++ b/pyodide-build/pyodide_build/pywasmcross.py @@ -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