Skip to content

remove emrun from emcc to avoid the game to keep calling stdio.html #238

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

Open
wants to merge 3 commits into
base: devel
Choose a base branch
from

Conversation

maiconpintoabreu
Copy link

Suggesting to remove --emrun as it makes the game to Post requests to stdio.html, if the developer needs it it can be added on the build.zig.
image

@Not-Nik
Copy link
Owner

Not-Nik commented May 1, 2025

I can't reproduce this and it doesn't really fix an issue. What exactly is causing this request?

@maiconpintoabreu
Copy link
Author

maiconpintoabreu commented May 1, 2025

Hi @Not-Nik, Sorry I will try to describe how to reproduce the issue.

Steps to reproduce the issue that this suggestion tries to solve.

1 - zig build -Dtarget=wasm32-emscripten -Doptimize=ReleaseSmall --sysroot ${ EMSDK_PATH }/upstream/emscripten

  • It will compile the wasm files in zig-out/htmlout

2 - python3 -m http.server or any http server to serve the files as if it was in a webservice like Itch.io
3 - Access the page and It will show on console straight away some errors like: POST http://localhost:8000/stdio.html 501 (Unsupported method ('POST'))

Workaround

The workaround is to add _ = link_step.argv.pop(); just after using linkWithEmscripten so it removes the --emrun from the arguments and if you do another release it will not produce any call to stdio.
PS. Removing --emrun should not effect zig build -Dtarget=wasm32-emscripten --sysroot ../emsdk/upstream/emscripten run

@Not-Nik
Copy link
Owner

Not-Nik commented May 26, 2025

Let's add a parameter to linkWithEmscripten, to control this behaviour. This would need to be updated in the project templates as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants