Panda3D WebGL Port!

I built the webgl port, though I am having issues when I try to run the Roaming Ralph sample. I get these errors:

Python 3.8.10 (tags/v3.8.10-dirty:3d8993a744, Nov 28 2021, 00:07:03)
[Clang 14.0.0 (GitHub - llvm/llvm-project: The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Note: the repository does not accept github pull requests at this moment. Please submit your patches at http://reviews.llvm.org. 4348cd42c385e71b63e5da7e492
Aborted(native code called abort())
RuntimeError: Aborted(native code called abort()) (evaluating ā€˜new WebAssembly.RuntimeError(what)ā€™)

Iā€™ve forgotten to mention that that issue has been fixed as of the latest version of the panda3d-webgl branch. It was happening when the html file was directly under the web root. Let me know if you are still encountering trouble.

1 Like

So will this Panda3D WebGL Live Python Editor be the place where I need to code in? Because I canā€™t find any way to publish it.

Or do I need to follow these instructions. https://rdb.name/panda3d-webgl.md.html

This is just a demonstration of real-time code editing in the browser.

Yes, you need to start with that.

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
1 Like

I added a debug symbol when compiling ralph, now I have this.

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:219 Uncaught RuntimeError: unreachable
    at signature_mismatch:time (roaming-ralph.wasm:0x29c23)
    at PyInit_time (timemodule.c:1774:9)
    at _imp_create_builtin (import.c:1225:19)
    at cfunction_vectorcall_O (methodobject.c:482:24)
    at PyVectorcall_Call (call.c:200:24)
    at PyCFunction_Call (call.c:775:12)
    at _PyEval_EvalFrameDefault (ceval.c:4983:9)
    at _PyEval_EvalCodeWithName (pycore_object.h:44:41)
    at _PyFunction_Vectorcall (call.c:436:12)
    at call_function (abstract.h:127:11)

This is probably the origin of the problem. I think Python needs to be recompiled for the newest emscripten version.

Yes, I have come to this conclusion. The problem is that windows is a bad choice for this.

However, I started by creating third-party dependencies using your repository on github, I have made progress on this. But due to the fact that I work on Windows, there are a lot of pitfalls. For example, you may need a linux system header and so on. But it works, so I can try to create python soon.

One guy was asked by a certain gaming web platform to make a dynamic page layout for publishing his game. The task is easily solved with css styles, and everything works great. But panda does not know about the window change and performs calculations with the cursor according to the old size, which leads to the fact that the DirectGUI elements do not coincide with the mouse position.

I came up with such a hack that changes the size of the panda window according to the event of changing the size of the canvas. However, a side effect has appeared, the size of the panda window does not increase in a big way, since the rules of html layout consist in wrapping the parent element.

        python from browser import console, document

        self.console = console
        self.canvas = document.getElementById('canvas')
        self.old_winsize = (0, 0)

        taskMgr.add(self.eventWinSize, 'eventWinSize')

    def eventWinSize(self, task):

        winsize = (self.canvas.getBoundingClientRect().width, self.canvas.getBoundingClientRect().height)

        if winsize != self.old_winsize:

            aspectRatio = int(winsize[0])/int(winsize[1])

            #self.console.log(str(aspectRatio))
            props = WindowProperties()
            props.size = int(winsize[0]), int(winsize[1])
            base.win.requestProperties(props)

        self.old_winsize = winsize

        

return task.cont

Example of behavior: link

The question is, is there any other way to deceive the panda by setting, for example, an additional multiplier(difference of sides) for the mouse on the x axis or something else?

I think I got the idea that the problem is the display region, since it does not scale with any events.

Default behavior without hacking. link

1 Like

Hmm, itā€™s possible that there is a bug here, since Panda should be detecting that the canvas has changed size and change everything appropriately, just as it would if you resized a window on the desktop.

I solved this problem by simply using the window dimensions, instead of the canvas. However, with this method, it is better to avoid explicitly setting the canvas size in css.

        from browser import window

        self.window = window
        self.old_winsize = (0, 0)

        taskMgr.add(self.eventWinSize, 'eventWinSize')

        self.scale_win = 75

    def eventWinSize(self, task):

        height = self.window.innerHeight
        width = self.window.innerWidth

        winsize = (width, height)

        if winsize != self.old_winsize:

            props = WindowProperties()
            props.size = (int(width/(100/self.scale_win)), int(height/(100/self.scale_win)))
            base.win.requestProperties(props)

        self.old_winsize = winsize

        return task.cont

demo music-box

Shaders donā€™t work, but in general it works well, and we can already create games for the web.

Actually, I would like to add a few words about this phenomenon, it turns out due to the fact that the size of the window and the canvas are different. When you use styles for the canvas, the window does not change. As a result, the alignment is lost.

Theoretically, this can be circumvented by additional code on Jawa, for example, by tracking a dummy block that reacts to css styles and dynamically changing the canvas based on its size.

1 Like

window resizing is not the only problem, thereā€™s also trouble with DirectGUI mouse position when using css scaling of canvas ( which allow for ultra fast full window scaling without changing render buffer size )

I think itā€™s a emscripten problem fix mouse position for 3D canvas by pmp-p Ā· Pull Request #20442 Ā· emscripten-core/emscripten Ā· GitHub but people from some other game engine says itā€™s Panda3Dā€™s problem to solve.

Shader do work they just need to have a suitable header like:

#version 300 es
precision mediump float;

NB: the Panda3D wasm wheel in pygbag is not affected by scaling/resizing thanks to all the reports above :slight_smile:

In fact, changing the window size and mouse position are two interrelated problems. This follows from the fact that panda is unaware of browser window change events.

indeed, and what is the point of implementing a large part (bloat/more calculations) of a window manager in javascript/C for a C++ engine that just usually wants to render - efficiently - only one surface ā€¦

When we merge shaderpipeline the problem with shaders will be fixed, because Panda will be able to convert the shaders. In the meantime, you need to write the shaders in ESSL, a dialect of GLSL. If you write them in ESSL 3.00, they will continue to work in all future versions of Panda3D, once shaderpipeline is merged.

I will have to take a look at the window size events sometime.

Hi folks!

Iā€™m currently trying to follow the Compiling Panda3D for WebGL article from rdb, and Iā€™m stuck trying to compile Panda with makepanda.

Iā€™m on Ubuntu 22.04.3 LTS, did a fresh install of Python 3.8, and Emscripten; path variables are set, and interrogate is available.

Command:

python3.8 makepanda/makepanda.py --nothing --use-python --use-vorbis --use-bullet --use-zlib --use-freetype --use-harfbuzz --use-openal --no-png --use-direct --use-gles2 --optimize 4 --static --target emscripten --threads 4

The terminal output is:

[T1] Building Interrogate database built/pandac/input/libp3dtoolbase.in
[T1] Building C++ object built/tmp/cpython-38/libp3dtoolbase_igate.o
[T3] Building C++ object built/tmp/cpython-38/p3dtoolbase_typeHandle_ext.o
built/tmp/libp3dtoolbase_igate.cxx:2694:3: error: cannot initialize a member subobject of type 'WrapFunction' (aka '_object *(*)(void *, _typeobject *)') with an lvalue of type 'void *(void *, Dtool_PyTypedObject *)': type mismatch at 2nd parameter ('PyTypeObject *' (aka '_typeobject *') vs 'Dtool_PyTypedObject *')
 2694 |   Dtool_DowncastInterface_NeverFreeMemory,
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
built/tmp/libp3dtoolbase_igate.cxx:3129:3: error: cannot initialize a member subobject of type 'WrapFunction' (aka '_object *(*)(void *, _typeobject *)') with an lvalue of type 'void *(void *, Dtool_PyTypedObject *)': type mismatch at 2nd parameter ('PyTypeObject *' (aka '_typeobject *') vs 'Dtool_PyTypedObject *')
 3129 |   Dtool_DowncastInterface_TypeHandle,
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
built/tmp/libp3dtoolbase_igate.cxx:3411:3: error: cannot initialize a member subobject of type 'WrapFunction' (aka '_object *(*)(void *, _typeobject *)') with an lvalue of type 'void *(void *, Dtool_PyTypedObject *)': type mismatch at 2nd parameter ('PyTypeObject *' (aka '_typeobject *') vs 'Dtool_PyTypedObject *')
 3411 |   Dtool_DowncastInterface_TypeRegistry,
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
built/tmp/libp3dtoolbase_igate.cxx:3691:3: error: cannot initialize a member subobject of type 'WrapFunction' (aka '_object *(*)(void *, _typeobject *)') with an lvalue of type 'void *(void *, Dtool_PyTypedObject *)': type mismatch at 2nd parameter ('PyTypeObject *' (aka '_typeobject *') vs 'Dtool_PyTypedObject *')
 3691 |   Dtool_DowncastInterface_TypedObject,
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
built/tmp/libp3dtoolbase_igate.cxx:3725:72: error: too few arguments to function call, expected 3, have 2
 3725 |     registry->record_python_type(handle, (PyObject *)&Dtool_TypedObject);
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                       ^
built/include/typeRegistry.h:53:8: note: 'record_python_type' declared here
   53 |   void record_python_type(TypeHandle type, PyTypeObject *cls,
      |        ^                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   54 |                           PythonWrapFunc *wrap_func);
      |                           ~~~~~~~~~~~~~~~~~~~~~~~~~
5 errors generated.
The following command returned a non-zero value: em++ -std=gnu++11 -ftemplate-depth-70 -fPIC -c -o built/tmp/cpython-38/libp3dtoolbase_igate.o -Ibuilt/tmp -Ibuilt/include -Ithirdparty/emscripten-libs/python/include -Ithirdparty/emscripten-libs/python/include/python3.8 -DLINK_ALL_STATIC= -Idtool/src/dtoolbase -fno-exceptions -s DISABLE_EXCEPTION_CATCHING=1 -fno-rtti -fno-strict-aliasing -ffast-math -fno-stack-protector -O3 -DNDEBUG -Wall -Wno-unused-function -Werror=return-type -Wno-unused-variable built/tmp/libp3dtoolbase_igate.cxx
Storing dependency cache.
Elapsed Time: 8 sec
Build process aborting.
Build terminated.

Iā€™ve tried to run the last command with the -save-temps flag, but the files being redone every time, I could not do much more than a visual check, and thatā€™s it.

Through some digging, it seems that the problem is caused by the combination of the flags ā€œā€“use pythonā€ and ā€œā€“target emscripten.ā€ Panda can build if either of those two is removed from the command, but it seems like both of them are pretty important.

I donā€™t know what else to do. I may try to do the build on another computer tomorrow and let you know if anything goes right, but I donā€™t know if anyone may have a lead maybe?

Thanks! :slight_smile:

edit:typos

Update :
Iā€™ve tried on a fresh ubuntu 22.04 VM and the same problem arose. Iā€™ve checked in terminal that everythingā€™s up, and it seems like it (?):

$ python3 --version
Python 3.8.6
$ python3 -m pip freeze
panda3d==1.10.9

$ source emsdk/emsdk_env.sh
Setting up EMSDK environment (suppress these messages with EMSDK_QUIET=1)
Adding directories to PATH:
PATH += /home/archy/desk/p3dWebBuild/emsdk
PATH += /home/archy/desk/p3dWebBuild/emsdk/upstream/emscripten

Setting environment variables:
PATH = /home/archy/desk/p3dWebBuild/emsdk:/home/archy/desk/p3dWebBuild/emsdk/upstream/emscripten:/home/archy/.pyenv/versions/3.8.6/bin:/home/archy/.pyenv/libexec:/home/archy/.pyenv/plugins/python-build/bin:/home/archy/.pyenv/plugins/pyenv-virtualenv/bin:/home/archy/.pyenv/plugins/pyenv-update/bin:/home/archy/.pyenv/plugins/pyenv-doctor/bin:/home/archy/.pyenv/plugins/pyenv-virtualenv/shims:/home/archy/.pyenv/shims:/home/archy/.pyenv/bin:/home/archy/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
EMSDK = /home/archy/desk/p3dWebBuild/emsdk
EMSDK_NODE = /home/archy/desk/p3dWebBuild/emsdk/node/16.20.0_64bit/bin/node

$ echo $EMSDK_NODE
/home/archy/desk/p3dWebBuild/emsdk/node/16.20.0_64bit/bin/node

$ emcc --version
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.52 (fa478400df3351f7153c0279bc638784d3d90334)
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.

$ interrogate --help
Usage:
  interrogate [opts] file.C [file.C ...]
  interrogate -h

Interrogate is a program to parse a body of C++ code and build up a table
of classes, methods, functions, and symbols found, for the purposes of
calling into the codebase via a non-C++ scripting language like Scheme,
Smalltalk, or Python.


$ cd panda3d-webgl

$ git pull
DĆ©jĆ  Ć  jour. *(Means "Up to date in french")*

$ wget https://rdb.name/webgl-editor-and-dependencies.zip
[...] Skipping those line but OK till the end :
(10,9 MB/s) - ā€˜webgl-editor-and-dependencies.zipā€™ enregistrĆ© [23459027/23459027]

$ unzip webgl-editor-and-dependencies.zip
[...] Skipping those line but OK till the end :
inflating: thirdparty/emscripten-libs/python/notes.txt  

So everything seems fine to me, according to requirements (unless iā€™ve missed something ?), then the build command and output :

$ python3.8 makepanda/makepanda.py --nothing --use-python --use-vorbis --use-bullet --use-zlib --use-freetype --use-harfbuzz --use-openal --no-png --use-direct --use-gles2 --optimize 4 --static --target emscripten --threads 4
Version: 1.11.0
Platform: emscripten-wasm32
Using Python 3.8
Target OS: emscripten
Target arch: wasm32
Generating dependencies...
WARNING: file depends on Python but is not in an ABI-specific directory: built/bin/deploy-stub.js
[T1] Building C++ object built/tmp/p3dtoolbase_composite1.o
[T2] Building C++ object built/tmp/p3dtoolbase_composite2.o
[T3] Building C object built/tmp/p3dtoolbase_lookup3.o
[T4] Building C++ object built/tmp/p3dtoolbase_indent.o
[T3] Building C++ object built/tmp/p3dtoolutil_composite1.o
[T4] Building C++ object built/tmp/p3dtoolutil_composite2.o
In file included from dtool/src/dtoolbase/p3dtoolbase_composite1.cxx:6:
In file included from dtool/src/dtoolbase/deletedBufferChain.cxx:14:
dtool/src/dtoolbase/deletedBufferChain.h:98:13: warning: private field '_lock' is not used [-Wunused-private-field]
   98 |   MutexImpl _lock;
      |             ^
1 warning generated.
[T1] Building C++ object built/tmp/p3dtool_dtool.o
[T1] Building Bison object built/tmp/p3cppParser_cppBison.o
[T2] Building C++ object built/tmp/p3prc_composite1.o
built/tmp/cppBison.yxx.c:3653:9: warning: variable 'cppyynerrs' set but not used [-Wunused-but-set-variable]
 3653 |     int yynerrs = 0;
      |         ^
built/tmp/cppBison.yxx.cxx:72:25: note: expanded from macro 'yynerrs'
   72 | #define yynerrs         cppyynerrs
      |                         ^
[T4] Building C++ object built/tmp/p3prc_composite2.o
[T3] Linking static library built/lib/libp3dtool.a
[T3] Building C++ object built/tmp/p3dtoolconfig_dtoolconfig.o
[T3] Building C++ object built/tmp/p3interrogatedb_composite1.o
1 warning generated.
[T1] Building C++ object built/tmp/p3cppParser_composite1.o
[T2] Building C++ object built/tmp/p3cppParser_composite2.o
[T4] Linking static library built/lib/libp3dtoolconfig.a
[T4] Building C++ object built/tmp/p3interrogatedb_composite2.o
[T3] Building C++ object built/tmp/cpython-38/interrogatedb_pydtool.o
[T4] Linking static library built/lib/libp3interrogatedb.a
[T4] Building C++ object built/tmp/interrogate_composite1.o
[T3] Linking static library built/lib/libpy.panda3d.interrogatedb.a
[T3] Building C++ object built/tmp/interrogate_composite2.o
[T1] Building C++ object built/tmp/interrogate_module_preamble_python_native.o
[T1] Building C++ object built/tmp/interrogate_module_interrogate_module.o
[T2] Linking static library built/tmp/libp3cppParser.a
[T2] Building C++ object built/tmp/parse_file_parse_file.o
[T3] Building C++ object built/tmp/test_interrogate_test_interrogate.o
[T1] Linking executable built/bin/interrogate_module.js
[T2] Linking executable built/bin/parse_file.js
[T3] Linking executable built/bin/test_interrogate.js
[T1] Building Interrogate database built/pandac/input/libp3dtoolbase.in
[T1] Building C++ object built/tmp/cpython-38/libp3dtoolbase_igate.o
[T3] Building C++ object built/tmp/cpython-38/p3dtoolbase_typeHandle_ext.o
built/tmp/libp3dtoolbase_igate.cxx:2694:3: error: cannot initialize a member subobject of type 'WrapFunction' (aka '_object *(*)(void *, _typeobject *)') with an lvalue of type 'void *(void *, Dtool_PyTypedObject *)': type mismatch at 2nd parameter ('PyTypeObject *' (aka '_typeobject *') vs 'Dtool_PyTypedObject *')
 2694 |   Dtool_DowncastInterface_NeverFreeMemory,
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
built/tmp/libp3dtoolbase_igate.cxx:3129:3: error: cannot initialize a member subobject of type 'WrapFunction' (aka '_object *(*)(void *, _typeobject *)') with an lvalue of type 'void *(void *, Dtool_PyTypedObject *)': type mismatch at 2nd parameter ('PyTypeObject *' (aka '_typeobject *') vs 'Dtool_PyTypedObject *')
 3129 |   Dtool_DowncastInterface_TypeHandle,
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
built/tmp/libp3dtoolbase_igate.cxx:3411:3: error: cannot initialize a member subobject of type 'WrapFunction' (aka '_object *(*)(void *, _typeobject *)') with an lvalue of type 'void *(void *, Dtool_PyTypedObject *)': type mismatch at 2nd parameter ('PyTypeObject *' (aka '_typeobject *') vs 'Dtool_PyTypedObject *')
 3411 |   Dtool_DowncastInterface_TypeRegistry,
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
built/tmp/libp3dtoolbase_igate.cxx:3691:3: error: cannot initialize a member subobject of type 'WrapFunction' (aka '_object *(*)(void *, _typeobject *)') with an lvalue of type 'void *(void *, Dtool_PyTypedObject *)': type mismatch at 2nd parameter ('PyTypeObject *' (aka '_typeobject *') vs 'Dtool_PyTypedObject *')
 3691 |   Dtool_DowncastInterface_TypedObject,
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
built/tmp/libp3dtoolbase_igate.cxx:3725:72: error: too few arguments to function call, expected 3, have 2
 3725 |     registry->record_python_type(handle, (PyObject *)&Dtool_TypedObject);
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                       ^
built/include/typeRegistry.h:53:8: note: 'record_python_type' declared here
   53 |   void record_python_type(TypeHandle type, PyTypeObject *cls,
      |        ^                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   54 |                           PythonWrapFunc *wrap_func);
      |                           ~~~~~~~~~~~~~~~~~~~~~~~~~
5 errors generated.
The following command returned a non-zero value: em++ -std=gnu++11 -ftemplate-depth-70 -fPIC -c -o built/tmp/cpython-38/libp3dtoolbase_igate.o -Ibuilt/tmp -Ibuilt/include -Ithirdparty/emscripten-libs/python/include -Ithirdparty/emscripten-libs/python/include/python3.8 -DLINK_ALL_STATIC= -Idtool/src/dtoolbase -fno-exceptions -s DISABLE_EXCEPTION_CATCHING=1 -fno-rtti -fno-strict-aliasing -ffast-math -fno-stack-protector -O3 -DNDEBUG -Wall -Wno-unused-function -Werror=return-type -Wno-unused-variable built/tmp/libp3dtoolbase_igate.cxx
Storing dependency cache.
Elapsed Time: 8 sec
Build process aborting.
Build terminated.

Iā€™ve saw that some managed to build on windows so I guess iā€™ll try when I get my hand on one, but Iā€™m starting to doubt that iā€™m able to do much more in this regard :confused: . Iā€™ll keep you updated as I go

I think the version of interrogate needs to match, which means you need to build Panda from source on the host.

1 Like

Heads-up: the webgl-port branch was merged into the master branch for ease of keeping up-to-date. You should now grab the master branch instead of webgl-port going forwards.

Thanks for the input on building Panda! :slight_smile:

Yeah, I noticed the branch change this morning and switched to the master branch. I wanted to let you know that the build was OK with Panda 1.11.0 but ended with:

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)

So, as seen in an older post by serega-kkz, Iā€™m currently trying to build Python 3.8. I had to deal with some errors ( _Py_Sigset_Converter and some of his friends), mainly struggling with a memfd_create related issue, but the newly compiled Python couldnā€™t execute makepanda correctly (core.so was built but crashed before direct.so was). I still need to dig a bit before running out of options, but iā€™ll let you updated.

Iā€™ll have to work on something else in the next few days, but Iā€™ll probably come back to it next week. Iā€™m hopefull to post a ā€œThe build is okay and running,ā€ but weā€™ll see, if things get too complicated, Iā€™ll probably make a dedicated thread with more info :slight_smile:

On a related note, itā€™s nice to see that the WebPort made its way into the master branch! :slight_smile: Thaks again for the work put into Panda !