@@ -511,13 +511,26 @@ The simplest way to install the Emscripten compiler is:
511
511
512
512
# Install Emscripten
513
513
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
516
516
source ./emsdk/emsdk_env.sh
517
517
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
521
534
522
535
Building for Emscripten requires doing a cross-build where you have a *build *
523
536
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
526
539
not meant for use by you directly, only the build system).
527
540
528
541
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:
531
544
532
545
.. code-block :: shell
533
546
@@ -545,6 +558,7 @@ is a convenience wrapper around the following commands:
545
558
python Tools/wasm/emscripten configure-build-python --quiet -- --config-cache --with-pydebug
546
559
python Tools/wasm/emscripten make-build-python --quiet
547
560
python Tools/wasm/emscripten make-libffi --quiet
561
+ python Tools/wasm/emscripten make-mpdec --quiet
548
562
python Tools/wasm/emscripten configure-host --quiet -- --config-cache
549
563
python Tools/wasm/emscripten make-host --quiet
550
564
@@ -572,6 +586,9 @@ used in ``python.sh``:
572
586
573
587
make -C cross-build/wasm32-emscripten/build/python/ test
574
588
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 `.
575
592
576
593
.. _Emscripten : https://emscripten.org/
577
594
.. _WebAssembly : https://webassembly.org
0 commit comments