-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Description
emrun cannot get output from a browser (tested for Firefox 135 and Chromium 133) for the apps compiled with emsdk v4.0.3 and v4.0.4:
Web server root directory: /tmp/em_test/v403
Starting web server: http://0.0.0.0:6931/
Starting browser: /usr/bin/xdg-open http://localhost:6931/main.html
/usr/bin/xdg-open
Searching for processes by full path name "/usr/bin/xdg-open".. found 0 entries
Launched browser process with pid=200059
Now listening at http://0.0.0.0:6931/
Entering web server loop.
First navigation occurred. Identifying currently running browser processes
Searching for processes by full path name "/usr/bin/xdg-open".. found 0 entries
Was unable to detect the browser process that was spawned by emrun. This may occur if the target page was opened in a tab on a browser process that already existed before emrun started up.
The html page you are running is not emrun-capable. Stdout, stderr and exit(returncode) capture will not work. Recompile the application with the --emrun linker flag to enable this, or pass --no-emrun-detect to emrun to hide this check.
For the apps compiled with emsdk v4.0.2, emrun works successfully:
Web server root directory: /tmp/em_test/v402
Starting web server: http://0.0.0.0:6931/
Starting browser: /usr/bin/xdg-open http://localhost:6931/main.html
/usr/bin/xdg-open
Searching for processes by full path name "/usr/bin/xdg-open".. found 0 entries
Launched browser process with pid=200392
Now listening at http://0.0.0.0:6931/
Entering web server loop.
First navigation occurred. Identifying currently running browser processes
Searching for processes by full path name "/usr/bin/xdg-open".. found 0 entries
Was unable to detect the browser process that was spawned by emrun. This may occur if the target page was opened in a tab on a browser process that already existed before emrun started up.
POST: "/stdio.html" (path: "/stdio.html", query: "")
POST: "/stdio.html" (path: "/stdio.html", query: "")
Hello, world!
POST: "/stdio.html" (path: "/stdio.html", query: "")
Shutting down because browser is no longer alive
Browser process has shut down, quitting web server.
Web page has quit with a call to exit() with return code 0. Shutting down web server. Pass --serve-after-exit to keep serving even after the page terminates with exit().
Web server loop done.
Closed web server.
emrun quitting with process exit code 0
Seems like it's caused by calling a non-existing addOnExit function from src/emrun_postjs.js. The function was moved in a series of commits:
13947f4 Unify more of the minimal runtime and normal runtime initialization code. (#23488)
a4f64a3 Move all addOn functions into a JS library. (#23565)
Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 4.0.3 (a9651ff57165f5710bb09a5fe52590fd6ddb72df)
clang version 21.0.0git (https:/github.com/llvm/llvm-project 6dc41a639334b913e762f65410fcd14a722b137f)
Target: wasm32-unknown-emscripten
Thread model: posix
Failing command line in full:
emcc -s ENVIRONMENT=web --emrun main.cpp -o main.html && emrun --verbose main.htmlmain.cpp:
#include <iostream>
int main()
{
std::cout << "Hello, world!" << std::endl;
return 0;
}Update 1: added info about v4.0.4.
Update 2: added info about the addOnExit function.
Update 3: updated the title.
Metadata
Metadata
Assignees
Labels
No labels