@@ -493,13 +493,27 @@ The simplest way to install the Emscripten compiler is:
493
493
494
494
# Install Emscripten
495
495
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
498
498
source ./emsdk/emsdk_env.sh
499
499
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
503
517
504
518
Building for Emscripten requires doing a cross-build where you have a *build *
505
519
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
508
522
not meant for use by you directly, only the build system).
509
523
510
524
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:
513
527
514
528
.. code-block :: shell
515
529
@@ -554,6 +568,9 @@ used in ``python.sh``:
554
568
555
569
make -C cross-build/wasm32-emscripten/build/python/ test
556
570
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 `.
557
574
558
575
.. _Emscripten : https://emscripten.org/
559
576
.. _WebAssembly : https://webassembly.org
0 commit comments