Some time ago I tested this on Windows. I am successfully building panda with Emscripten, except for some moments.
The end of the sbrki breaks because of the command.
os.system("chmod +x " + BracketNameWithQuotes(dll))
I have made such a patch:
# fix for emscripten, which is on windows.
if GetHost() != "windows":
os.system("chmod +x " + BracketNameWithQuotes(dll))
Another problem is the absence of the OpenAL library in the third-party dependencies folder, I canāt imagine where it can be taken.
Therefore, I put together an example of Ralph without a sound module, having previously set in the script.
loadPrcFileData("", "audio-library-name null")
However, when I freeze Ralphās example, I get this console output.
D:\panda3d-webgl\roaming-ralph>call D:\emsdk\emsdk_env.bat
Setting up EMSDK environment (suppress these messages with EMSDK_QUIET=1)
Adding directories to PATH:
PATH += D:\emsdk
PATH += D:\emsdk\upstream\emscripten
PATH += D:\emsdk\node\14.18.2_64bit\bin
Setting environment variables:
PATH = D:\emsdk;D:\emsdk\upstream\emscripten;D:\emsdk\node\14.18.2_64bit\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\sereg\AppData\Local\Programs\Python\Python38\Scripts\;C:\Users\sereg\AppData\Local\Programs\Python\Python38\;C:\Users\sereg\AppData\Local\Microsoft\WindowsApps;D:\Panda3D-1.10.10-x64\python;D:\Panda3D-1.10.10-x64\python\Scripts;D:\Panda3D-1.10.10-x64\bin
EMSDK = D:/emsdk
EM_CONFIG = D:\emsdk\.emscripten
EMSDK_NODE = D:\emsdk\node\14.18.2_64bit\bin\node.exe
EMSDK_PYTHON = D:\emsdk\python\3.9.2-nuget_64bit\python.exe
JAVA_HOME = D:\emsdk\java\8.152_64bit
Clearing existing environment variable: EMSDK_PY
There are some missing modules: ['__builtin__', '_posixsubprocess', 'grp', 'panda3d.core', 'panda3d.direct']
emcc -O3 -fno-exceptions -fno-rtti -c -o roaming-ralph.o roaming-ralph.c -ID:/panda3d-webgl/thirdparty/emscripten-libs/python/include/python3.8
emcc -O3 -s TOTAL_MEMORY=50331648 -s ASSERTIONS=0 -s MAX_WEBGL_VERSION=2 -s NO_EXIT_RUNTIME=1 -fno-exceptions -fno-rtti -o roaming-ralph.js roaming-ralph.o D:/panda3d-webgl/thirdparty/emscripten-libs/python/lib/libpython3.8.a D:/panda3d-webgl/built/lib/libpy.panda3d.core.a D:/panda3d-webgl/built/lib/libpy.panda3d.direct.a D:/panda3d-webgl/built/lib/libp3interrogatedb.a D:/panda3d-webgl/built/lib/libpanda.a D:/panda3d-webgl/built/lib/libpandaexpress.a D:/panda3d-webgl/built/lib/libp3dtool.a D:/panda3d-webgl/built/lib/libp3dtoolconfig.a D:/panda3d-webgl/built/lib/libp3webgldisplay.a D:/panda3d-webgl/built/lib/libp3direct.a -ID:/panda3d-webgl/built/include -s USE_ZLIB=1 -s USE_VORBIS=1 -s USE_LIBPNG=1 -s USE_FREETYPE=1 -s USE_HARFBUZZ=1 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s DISABLE_EXCEPTION_THROWING=0 --preload-file models/ground.jpg --preload-file models/hedge.jpg --preload-file models/ralph.bam --preload-file models/ralph.jpg --preload-file models/ralph-run.bam --preload-file models/ralph-walk.bam --preload-file models/rock03.jpg --preload-file models/tree.jpg --preload-file models/world.bam
wasm-ld: warning: function signature mismatch: time
>>> defined as (i32) -> i32 in D:/panda3d-webgl/thirdparty/emscripten-libs/python/lib/libpython3.8.a(timemodule.o)
>>> defined as (i32) -> i64 in D:\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\libc.a(emscripten_time.o)
wasm-ld: warning: function signature mismatch: mktime
>>> defined as (i32) -> i32 in D:/panda3d-webgl/thirdparty/emscripten-libs/python/lib/libpython3.8.a(timemodule.o)
>>> defined as (i32) -> i64 in D:\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\libc.a(emscripten_time.o)
There are warnings. And then when you try to run in the browser, nothing happens, but there are errors in the Javascript console.
roaming-ralph.html:161 Python 3.8.10 (tags/v3.8.10-dirty:3d8993a744, Nov 28 2021, 00:07:03)
printErr @ roaming-ralph.html:161
roaming-ralph.html:161 [Clang 14.0.0 (https://github.com/llvm/llvm-project 4348cd42c385e71b63e5da7e492
printErr @ roaming-ralph.html:161
roaming-ralph.js:1 Uncaught RuntimeError: unreachable
at roaming-ralph.wasm:0x81b88c
at roaming-ralph.wasm:0x9c0bec
at roaming-ralph.wasm:0x63e083
at roaming-ralph.wasm:0x232f3c
at roaming-ralph.wasm:0x231e7a
at roaming-ralph.wasm:0x2fdb52
at roaming-ralph.wasm:0x2204a2
at roaming-ralph.wasm:0x7132db
at roaming-ralph.wasm:0x21f33c
at roaming-ralph.wasm:0x2fd738