Skip to content

Commit 150a271

Browse files
committed
update documentation for emscripten builds
* update emsdk version information * link to `Tools/wasm/README.md` for usage instructions beyond what's shown here * add note about ccache * add note about minimum Python version for `Tools/wasm/emscripten build`
1 parent e4f4b21 commit 150a271

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
@@ -493,13 +493,27 @@ The simplest way to install the Emscripten compiler is:
493493
494494
# Install Emscripten
495495
git clone https://github.com/emscripten-core/emsdk
496-
./emsdk/emsdk install 4.0.5
497-
./emsdk/emsdk activate 4.0.5
496+
./emsdk/emsdk install 4.0.11
497+
./emsdk/emsdk activate 4.0.11
498498
source ./emsdk/emsdk_env.sh
499499
500-
Updating the Emscripten compiler version often causes breakages. For the best
501-
compatibility, use the Emscripten version suggested in the cpython repository in
502-
``Tools/wasm/README.md``.
500+
Updating the Emscripten compiler version can cause breakages. For the best
501+
compatibility, use the appropriate Emscripten version based on the version of
502+
CPython you're building:
503+
504+
* For building CPython 3.14, use ``emsdk`` version ``4.0.11``.
505+
* For building CPython 3.13, use ``emsdk`` version ``4.0.5``.
506+
* For building the main branch of the CPython repository, you may wish to use
507+
``latest`` instead of a specific version.
508+
509+
It is possible (but not necessary) to enable ``ccache`` for Emscripten builds
510+
by setting the ``EM_COMPILER_WRAPPER`` environment, but this step will only
511+
take effect if it is done **after** ``emsdk_env.sh`` is sourced (otherwise, the
512+
sourced script removes the environment variable):
513+
514+
.. code-block:: sh
515+
516+
export EM_COMPILER_WRAPPER=ccache
503517
504518
Building for Emscripten requires doing a cross-build where you have a *build*
505519
Python to help produce an Emscripten build of CPython. This means you build
@@ -508,8 +522,8 @@ another that's the build you ultimately care about (that is, the build Python is
508522
not meant for use by you directly, only the build system).
509523

510524
The easiest way to get a debug build of CPython for Emscripten is to use the
511-
``Tools/wasm/emscripten build`` command (which should be run with a recent
512-
version of Python you have installed on your machine):
525+
``Tools/wasm/emscripten build`` command, which should be run with a recent
526+
version of Python (3.13 or newer) already installed on your machine:
513527

514528
.. code-block:: shell
515529
@@ -554,6 +568,9 @@ used in ``python.sh``:
554568
555569
make -C cross-build/wasm32-emscripten/build/python/ test
556570
571+
Additional instructions for running the resulting builds (through Node.js and/or
572+
through web browsers) are available in the CPython repository at
573+
:cpy-file:`Tools/wasm/README.md`.
557574

558575
.. _Emscripten: https://emscripten.org/
559576
.. _WebAssembly: https://webassembly.org

0 commit comments

Comments
 (0)