Skip to content

Commit 87c99bc

Browse files
adqmfreakboy3742AA-Turner
authored
Update documentation for Emscripten Builds (#1621)
Co-authored-by: Russell Keith-Magee <[email protected]> Co-authored-by: Adam Turner <[email protected]>
1 parent 23d4a35 commit 87c99bc

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

getting-started/setup-building.rst

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -511,13 +511,26 @@ The simplest way to install the Emscripten compiler is:
511511
512512
# Install Emscripten
513513
git clone https://github.com/emscripten-core/emsdk
514-
./emsdk/emsdk install 4.0.5
515-
./emsdk/emsdk activate 4.0.5
514+
./emsdk/emsdk install 4.0.12
515+
./emsdk/emsdk activate 4.0.12
516516
source ./emsdk/emsdk_env.sh
517517
518-
Updating the Emscripten compiler version often causes breakages. For the best
519-
compatibility, use the Emscripten version suggested in the cpython repository in
520-
``Tools/wasm/README.md``.
518+
Updating the Emscripten compiler version can cause breakages. For the best
519+
compatibility, use the appropriate Emscripten version based on the version of
520+
CPython you're building:
521+
522+
* For building CPython 3.14, use ``emsdk`` version ``4.0.12``.
523+
* For building the main branch of the CPython repository, you may wish to use
524+
``latest`` instead of a specific version.
525+
526+
It is possible (but not necessary) to enable ``ccache`` for Emscripten builds
527+
by setting the ``EM_COMPILER_WRAPPER`` environment, but this step will only
528+
take effect if it is done **after** ``emsdk_env.sh`` is sourced (otherwise, the
529+
sourced script removes the environment variable):
530+
531+
.. code-block:: sh
532+
533+
export EM_COMPILER_WRAPPER=ccache
521534
522535
Building for Emscripten requires doing a cross-build where you have a *build*
523536
Python to help produce an Emscripten build of CPython. This means you build
@@ -526,8 +539,8 @@ another that's the build you ultimately care about (that is, the build Python is
526539
not meant for use by you directly, only the build system).
527540

528541
The easiest way to get a debug build of CPython for Emscripten is to use the
529-
``Tools/wasm/emscripten build`` command (which should be run with a recent
530-
version of Python you have installed on your machine):
542+
``Tools/wasm/emscripten build`` command, which should be run with a recent
543+
version of Python (3.13 or newer) already installed on your machine:
531544

532545
.. code-block:: shell
533546
@@ -545,6 +558,7 @@ is a convenience wrapper around the following commands:
545558
python Tools/wasm/emscripten configure-build-python --quiet -- --config-cache --with-pydebug
546559
python Tools/wasm/emscripten make-build-python --quiet
547560
python Tools/wasm/emscripten make-libffi --quiet
561+
python Tools/wasm/emscripten make-mpdec --quiet
548562
python Tools/wasm/emscripten configure-host --quiet -- --config-cache
549563
python Tools/wasm/emscripten make-host --quiet
550564
@@ -572,6 +586,9 @@ used in ``python.sh``:
572586
573587
make -C cross-build/wasm32-emscripten/build/python/ test
574588
589+
Additional instructions for running the resulting builds (through Node.js and/or
590+
through web browsers) are available in the CPython repository at
591+
:cpy-file:`Tools/wasm/README.md`.
575592

576593
.. _Emscripten: https://emscripten.org/
577594
.. _WebAssembly: https://webassembly.org

0 commit comments

Comments
 (0)