-
-
Notifications
You must be signed in to change notification settings - Fork 827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add section on building for Emscripten #1533
base: main
Are you sure you want to change the base?
Conversation
Heavily copied from Brett's WASI guide.
getting-started/setup-building.rst
Outdated
Building for Emscripten requires doing a cross-build where you have a *build* | ||
Python to help produce a Emscripten build of CPython. This means you build | ||
CPython twice: once to have a version of Python for the build system to use and | ||
another that's the build you ultimately care about (that is, the build Python is | ||
not meant for use by you directly, only the build system). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of (almost) duplicating things, maybe this could refer (and link) to the section above, e.g.:
"Like WASI, you will have to build Python twice."
I haven't looked at them side-by-side to see how similar they are, but if they are quite similar another option is merging the two sections and using tabs where they are different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to duplicate since there's no reason to think they won't diverge in the future. And I don't want to cause trouble for @brettcannon. Let's see what he thinks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with duplication to avoid issues for accidental divergence.
Do note that I didn't add the WASI docs until WASI explicitly reached tier 2. I don't know if we have a defined policy around this, though, beyond me just wanting to personally wait until I reached the tier 2 milestone. |
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Thanks for the edits @hugovk! |
# Install Emscripten | ||
git clone emscripten/emsdk | ||
./emsdk/emsdk install 4.0.5 | ||
./emsdk/emsdk activate 4.0.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a safety catch for the future - do we want to flag that this version number is significant, and you should be using the version that Python is targeting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do people figure out which version Python is targeting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that's the question for the documentation to resolve :-)
Right now, I'd say it's a case of "check the Emscripten README to find the version you need".
Longer term, maybe it would be worth adding a helper entry point to the Tools/wasm/emscripten
script that will print/verify the required emscripten version? That would mean the emscripten version is defined in code, and can be checked at runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also define a container in https://github.com/python/cpython-devcontainers/ and somehow specify which build that branch of CPython is tied to.
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Heavily copied from Brett's WASI guide.
📚 Documentation preview 📚: https://cpython-devguide--1533.org.readthedocs.build/getting-started/setup-building/#emscripten