Skip to content
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

Wasm build instructions are confusing to this wasm newbie #95205

Open
smontanaro opened this issue Jul 24, 2022 · 4 comments
Open

Wasm build instructions are confusing to this wasm newbie #95205

smontanaro opened this issue Jul 24, 2022 · 4 comments
Assignees
Labels
docs triaged

Comments

@smontanaro
Copy link
Contributor

@smontanaro smontanaro commented Jul 24, 2022

Documentation

I know nothing about wasm or emscripten, but am curious. I know next-to-nothing (anymore) about Docker. So, naively working my way through Tools/wasm/README.md I see:

docker run --rm -ti -v $(pwd):/python-wasm/cpython quay.io/tiran/cpythonbuild:emsdk3

followed immediately by

mkdir -p builddir/build
pushd builddir/build
../../configure -C
make -j$(nproc)
popd

The docker run command puts me in a docker shell, from which the configure command is pretty worthless. It seems I am supposed to be back at my computer's prompt, but what good is the docker run command at that point? Am I supposed to check out .../python/cpython inside the docker env? I'm clearly missing something and suspect other people new to wasm probably are as well.

@smontanaro smontanaro added the docs label Jul 24, 2022
@erlend-aasland
Copy link
Contributor

@erlend-aasland erlend-aasland commented Jul 24, 2022

  • The docker command should be executed from your local CPython repo clone (pwd == CPython repo).
  • ../../configure -C should be ../../cpython/configure -C

The docker run command puts me in a docker shell, from which the configure command is pretty worthless. It seems I am supposed to be back at my computer's prompt, but what good is the docker run command at that point?

No, it is not worthless; the -v option to docker run maps $(pwd) to /python-wasm/cpython inside the Docker container. You're supposed to run configure and make from within the container.

Am I supposed to check out .../python/cpython inside the docker env

No need. It is already mapped via the -v option.

@erlend-aasland erlend-aasland self-assigned this Jul 24, 2022
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Jul 24, 2022
@smontanaro
Copy link
Contributor Author

@smontanaro smontanaro commented Jul 24, 2022

Thanks. the incorrect configure reference was the problem. make is now making.

@tiran
Copy link
Member

@tiran tiran commented Jul 24, 2022

The documentation assumes that you run all commands from a CPython checkout inside and outside the container. Depending on how you run the container, you may /python-wasm as working directory. You need to run the commands from /python-wasm/cpython -- or better use the shell scripts in /python-wasm.

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 25, 2022
Co-authored-by: Christian Heimes <christian@python.org>
(cherry picked from commit 310f94871a923f6cf3dc9259e732ce2376578b26)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
erlend-aasland added a commit that referenced this issue Jul 25, 2022
Co-authored-by: Christian Heimes <christian@python.org>
miss-islington added a commit that referenced this issue Jul 25, 2022
Co-authored-by: Christian Heimes <christian@python.org>
(cherry picked from commit 310f948)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
@smontanaro
Copy link
Contributor Author

@smontanaro smontanaro commented Jul 25, 2022

Latest changes worked for me until I got here:

emrun builddir/emscripten-browser/python.html

This failed from inside the running Docker image with this error:

Unable to find browser "firefox"! Check the correctness of the passed --browser=xxx parameter!

I don't know where browser firefox is specified. Must be a default.

The second option (running wasm_webserver.py) worked for me outside the running image. Assuming it's less picky about available web browsers, maybe it should be the first option.

@erlend-aasland erlend-aasland added the triaged label Jul 25, 2022
tiran added a commit to tiran/cpython that referenced this issue Jul 26, 2022
- drop ``emrun``
- add build and debug instructions for WASI
- add wasi-env helper script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs triaged
Projects
None yet
Development

No branches or pull requests

3 participants