yglukhov / nimx

GUI library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

emscripten target fails in browser

capocasa opened this issue · comments

Reproduction:

import nimx/naketools > nakefile.nim
echo "import nimx / [ window, layout, button, text_field ]

runApplication:
    let w = newWindow(newRect(50, 50, 500, 150))
" > main.nim

nake emscripten

# noise happens, browser starts

In browser console:

Expected: See demo nimx app gui in http://localhost:5000/main.html

Actual: See blank page in http://localhost:5000/main.html, and error when opening javascript console:

Uncaught (in promise) TypeError: Module.FS_createPath is not a function
    runWithFS http://127.0.0.1:5000/main.js:1
    callRuntimeCallbacks http://127.0.0.1:5000/main.js:1
    preRun http://127.0.0.1:5000/main.js:1
    run http://127.0.0.1:5000/main.js:1
    runCaller http://127.0.0.1:5000/main.js:1
    removeRunDependency http://127.0.0.1:5000/main.js:1
    receiveInstance http://127.0.0.1:5000/main.js:1
    receiveInstantiatedSource http://127.0.0.1:5000/main.js:1
    promise callback*instantiateAsync/< http://127.0.0.1:5000/main.js:1
    promise callback*instantiateAsync http://127.0.0.1:5000/main.js:1
    createWasm http://127.0.0.1:5000/main.js:1
    <anonymous> http://127.0.0.1:5000/main.js:1

Platform: Arch linux, up-to-date

Firefox version: 83
Chromium version: 87

emcc --version
emcc (Emscripten gcc/clang-like replacement) 2.0.7 (84212966aa4ac514caa848c7a8854d099b55d198)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ nim -v
Nim Compiler Version 1.4.0 [Linux: amd64]
Compiled at 2020-10-16
Copyright (c) 2006-2020 by Andreas Rumpf

active boot switches: -d:release -d:nativeStackTrace

Just rembered after creating this report to reproduce with dev version of Nim, will do that- this is 1.4 production Nim. I'm guessing it shouldn't matter in this case.

OK reproduced this with the latest master built from source, same behavior.

$ nim -v
Nim Compiler Version 1.5.1 [Linux: amd64]
Compiled at 2020-12-03
Copyright (c) 2006-2020 by Andreas Rumpf

git hash: b1554cfeb54dcbd456d3ecc85f6db44c1133d8e0
active boot switches: -d:release
ncaught (in promise) TypeError: Module.FS_createPath is not a function
    runWithFS http://localhost:5000/main.js:1
    callRuntimeCallbacks http://localhost:5000/main.js:1
    preRun http://localhost:5000/main.js:1
    run http://localhost:5000/main.js:1
    runCaller http://localhost:5000/main.js:1
    removeRunDependency http://localhost:5000/main.js:1
    receiveInstance http://localhost:5000/main.js:1
    receiveInstantiatedSource http://localhost:5000/main.js:1
main.js:1:2964
Uncaught (in promise) TypeError: Module.FS_createPath is not a function
    runWithFS http://localhost:5000/main.js:1
    callRuntimeCallbacks http://localhost:5000/main.js:1
    preRun http://localhost:5000/main.js:1
    run http://localhost:5000/main.js:1
    runCaller http://localhost:5000/main.js:1
    removeRunDependency http://localhost:5000/main.js:1
    receiveInstance http://localhost:5000/main.js:1
    receiveInstantiatedSource http://localhost:5000/main.js:1
    promise callback*instantiateAsync/< http://localhost:5000/main.js:1
    promise callback*instantiateAsync http://localhost:5000/main.js:1
    createWasm http://localhost:5000/main.js:1
    <anonymous> http://localhost:5000/main.js:1
main.js:1:2964
GEThttp://localhost:5000/favicon.ico
[HTTP/1.1 404 Not Found 0ms]