Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Hello World app with QML & WebAssembly not working



  • I found Developing Web apps using QML and Qt for WebAssembly which is a nice tutorial.

    I successfully completed the steps:

    $ ~/qt/5.15.2/wasm_32/bin/qmake ..
    $ make
    

    As near as I can tell, everything built successfully without error.

    however, when I went to run, I got:

    $ emrun — browser=firefox *.html
    Starting browser: open http://localhost:6931/—?browser=firefox&default.html
    The file /Users/ericg/depot_qt/default/build/http:/localhost:6931/—?browser=firefox&default.html does not exist.
    
    $ ls -la
    total 33776
    drwxr-xr-x  16 ericg  staff       512 Oct 10 20:43 .
    drwxr-xr-x  10 ericg  staff       320 Oct 10 20:36 ..
    -rw-r--r--   1 ericg  staff       513 Oct 10 20:37 .qmake.stash
    -rw-r--r--   1 ericg  staff     49028 Oct 10 20:41 Makefile
    -rw-r--r--@  1 ericg  staff      3229 Oct 10 20:41 default.html
    -rw-r--r--   1 ericg  staff    333625 Oct 10 20:43 default.js
    -rw-r--r--   1 ericg  staff       449 Oct 10 20:37 default.js_plugin_import.cpp
    -rw-r--r--   1 ericg  staff      1259 Oct 10 20:41 default.js_plugin_import.o
    -rw-r--r--   1 ericg  staff       270 Oct 10 20:37 default.js_qml_plugin_import.cpp
    -rw-r--r--   1 ericg  staff       848 Oct 10 20:41 default.js_qml_plugin_import.o
    -rw-r--r--   1 ericg  staff  16544459 Oct 10 20:43 default.wasm
    -rw-r--r--   1 ericg  staff      2455 Oct 10 20:41 main.o
    -rw-r--r--   1 ericg  staff      3703 Oct 10 20:41 qrc_qml.cpp
    -rw-r--r--   1 ericg  staff      1510 Oct 10 20:41 qrc_qml.o
    -rw-r--r--   1 ericg  staff     21742 Oct 10 20:41 qtloader.js
    -rw-r--r--   1 ericg  staff      3047 Oct 10 20:41 qtlogo.svg
    

    and nothing comes up.

    Any idea on what I did wrong?



  • @ericg_97477

    I ended up trying an alternate way to use emrun...

    $ emrun --no_browser --port 8080 ./default.html
    Web server root directory: /Users/ericg/depot_qt/default/build
    Now listening at http://0.0.0.0:8080/
    

    I then went to http://0.0.0.0:8080/ in the browser. I was shown the expected page:

    Directory listing for /
    

    with all of the files in my build folder.

    When I clicked on default.html, I saw the QT icon and it a message that it was downloading the program. Eventually, I saw the the hello world message appear.

    I assume I would eventually be able to take control over the loading screen.

    So, that worked.

    Why didn't emrun — browser=firefox *.html?


Log in to reply