Skip to content

Emscripten build fails with Python 3.14 #137025

@treyhunner

Description

@treyhunner

Bug report

Bug description:

I tried to use emsdk 4.10.0 and ran ./Tools/wasm/wasm_build.py emscripten-browser build repl against the v3.14.0rc1 branch, but the build failed:

configure: error: You must get working getaddrinfo() function or pass the "--disable-ipv6" option to configure.
emconfigure: error: '../../configure -C --host=wasm32-unknown-emscripten --build=x86_64-unknown-linux-gnu --with-emscripten-target=browser --enable-wasm-dynamic-linking --with-build-python=/tmp/wasm/cpython/builddir/build/python CONFIG_SITE=/tmp/wasm/cpython/Tools/wasm/config.site-wasm32-emscripten' failed (returned 1)
Traceback (most recent call last):
  File "/tmp/wasm/cpython/./Tools/wasm/wasm_build.py", line 932, in <module>
    main()
    ~~~~^^
  File "/tmp/wasm/cpython/./Tools/wasm/wasm_build.py", line 902, in main
    builder.run_build(*cm_args)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/tmp/wasm/cpython/./Tools/wasm/wasm_build.py", line 571, in run_build
    self.run_configure(*args)
    ~~~~~~~~~~~~~~~~~~^^^^^^^
  File "/tmp/wasm/cpython/./Tools/wasm/wasm_build.py", line 577, in run_configure
    return self._run_cmd(self.configure_cmd, args)
           ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/wasm/cpython/./Tools/wasm/wasm_build.py", line 557, in _run_cmd
    return subprocess.check_call(
           ~~~~~~~~~~~~~~~~~~~~~^
        cmd,
        ^^^^
        cwd=os.fspath(cwd),
        ^^^^^^^^^^^^^^^^^^^
        env=self.getenv(),
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/trey/.local/share/uv/python/cpython-3.13.1-linux-x86_64-gnu/lib/python3.13/subprocess.py", line 419, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/opt/emsdk/upstream/emscripten/emconfigure', '../../configure', '-C', '--host=wasm32-unknown-emscripten', '--build=x86_64-unknown-linux-gnu', '--with-emscripten-target=browser', '--enable-wasm-dynamic-linking', '--with-build-python=/tmp/wasm/cpython/builddir/build/python', 'CONFIG_SITE=/tmp/wasm/cpython/Tools/wasm/config.site-wasm32-emscripten']' returned non-zero exit status 1.

It seems like the config_site settings are pointing to the wrong subdirectories.

I fixed that for Emscripten like this (in this branch):

 EMSCRIPTEN = Platform(
     "emscripten",
     pythonexe="python.js",
-    config_site=WASMTOOLS / "config.site-wasm32-emscripten",
+    config_site=WASMTOOLS / "emscripten"/ "config.site-wasm32-emscripten",

The build still fails after this:

emcc: warning: EXPORTED_FUNCTIONS is not valid with LINKABLE set (normally due to SIDE_MODULE=1/MAIN_MODULE=1) since all functions are exported this mode.  To export only a subset use SIDE_MODULE=2/MAIN_MODULE=2 [-Wunused-command-line-argument]
emcc: error: undefined exported symbol: "__PyEM_EMSCRIPTEN_COUNT_ARGS_OFFSET" [-Wundefined] [-Werror]
make: *** [Makefile:1115: python.mjs] Error 1
emmake: error: 'make all' failed (returned 2)
Traceback (most recent call last):
  File "/tmp/wasm/cpython/./Tools/wasm/wasm_build.py", line 932, in <module>
    main()
    ~~~~^^
  File "/tmp/wasm/cpython/./Tools/wasm/wasm_build.py", line 902, in main
    builder.run_build(*cm_args)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/tmp/wasm/cpython/./Tools/wasm/wasm_build.py", line 572, in run_build
    self.run_make("all", *args)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/tmp/wasm/cpython/./Tools/wasm/wasm_build.py", line 581, in run_make
    return self._run_cmd(self.make_cmd, args)
           ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/wasm/cpython/./Tools/wasm/wasm_build.py", line 557, in _run_cmd
    return subprocess.check_call(
           ~~~~~~~~~~~~~~~~~~~~~^
        cmd,
        ^^^^
        cwd=os.fspath(cwd),
        ^^^^^^^^^^^^^^^^^^^
        env=self.getenv(),
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/trey/.local/share/uv/python/cpython-3.13.1-linux-x86_64-gnu/lib/python3.13/subprocess.py", line 419, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/opt/emsdk/upstream/emscripten/emmake', 'make', 'all']' returned non-zero exit status 1.

Using emsdk 4.10.0 and running ./Tools/wasm/wasm_build.py emscripten-browser build repl against the v3.13.5 branch works.

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

Labels

3.14bugs and security fixesOS-emscriptendocsDocumentation in the Doc dir

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions