I compared the files libp3collide_igate.cxx in the two webgl-port directories (the first one I downloaded that works and the current download) and there are 502 differences. They are very different files.
I substituted the ‘new’ version with the ‘old’ version and restarted the build.
Successful! On both systems. This seems to be the source of the problem, whatever creates that file.
The file is created by interrogate, a tool that ships with Panda3D, hence I thought there might have been a version mismatch.
But I’m glad that the issue was fixed.
I don’t know about the png.h issues. If Panda is passing -s USE_PNG=1 to emscripten, than should be enough. You can use --verbose to see if it is. That said, you can also pass --no-png, and Panda will use the browser’s ability to decode .png files instead.
The issue was fixed by my patch, but for others to use the script, do they need a different version of panda3d?
I think my earlier builds were accidentally using —use-png and later in the flag set --no-png. That explains why the earlier versions did give this error. Both work in a final app build, but --no-png is what I will put in my script because then it doesn’t need the extra .h files.
I made a ‘mobile ready’ browser version of the game, putting up navigation buttons to use instead of keyboard keys. I managed to find button.guiItem.isButtonDown(), works great – on laptops. Kind of hidden in the documentation, though, but a great feature.
But unfortunately that feature does not work on phones and tablets. It works great on mouse button press, but not touch screen events.
Is there a way to suppress the keyboard popping up every time someone touches a screen button (DirectButton)? It shouldn’t, a touch event is not a text input, but I cannot suppress it. Maybe a different kind of button?
Hmm, interesting. We may need to do some work on the C++ end of Panda to better support touch handling. That work would benefit the Android port as well.
I expect that it would be possible to use JavaScript or CSS to disable the onscreen keyboard, absent a specific feature in Panda. In fact, I wonder if setting the contentEditable flag in the .html file prompted it to be displayed.
Build from scratch on linux close but not quite. I got these errors trace in makepanda:
error: undefined symbol: adler32 (referenced by top-level compiled C/C++ code)
warning: Link with -s LLD_REPORT_UNDEFINED to get more information on undefined symbols
warning: To disable errors for undefined symbols use -s ERROR_ON_UNDEFINED_SYMBOLS=0
warning: _adler32 may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: crc32 (referenced by top-level compiled C/C++ code)
warning: _crc32 may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: deflate (referenced by top-level compiled C/C++ code)
warning: _deflate may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: deflateCopy (referenced by top-level compiled C/C++ code)
warning: deflateCopy may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: deflateEnd (referenced by top-level compiled C/C++ code)
warning: deflateEnd may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: deflateInit2 (referenced by top-level compiled C/C++ code)
warning: deflateInit2 may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: deflateInit (referenced by top-level compiled C/C++ code)
warning: deflateInit may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: deflateSetDictionary (referenced by top-level compiled C/C++ code)
warning: _deflateSetDictionary may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: inflate (referenced by top-level compiled C/C++ code)
warning: _inflate may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: inflateCopy (referenced by top-level compiled C/C++ code)
warning: _inflateCopy may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: inflateEnd (referenced by top-level compiled C/C++ code)
warning: inflateEnd may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: inflateInit2 (referenced by top-level compiled C/C++ code)
warning: inflateInit2 may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: inflateSetDictionary (referenced by top-level compiled C/C++ code)
warning: _inflateSetDictionary may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: zlibVersion (referenced by top-level compiled C/C++ code)
warning: _zlibVersion may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
Error: Aborting compilation due to previous errors
em++: error: ‘/home/david/prog/emsdk/node/12.18.1_64bit/bin/node /home/david/prog/emsdk/upstream/emscripten/src/compiler.js /tmp/tmpnaset4w9.txt’ failed (1)
The following command returned a non-zero value: em++ -o embuilt/bin/deploy-stub.js -Lembuilt/lib -Lembuilt/tmp embuilt/tmp/cpython-38-x86_64-linux-gnu/deploy-stub.bc -s WARN_ON_UNDEFINED_SYMBOLS=1 --memory-init-file 0 -s EXIT_RUNTIME=1 thirdparty/emscripten-libs/python/lib/libpython3.8.a -O3
It did build core and direct, so I did a freeze of the app. It seemed to work, but there were 3 missing references at the end (init_libOpenALAudio, init_libwebgldisplay, init_libpnmimagetypes) and of course the app has an expected error:
The same lines that I had to insert a couple of weeks ago to make the app show up in the browser. Huh?
makepanda build still dies at 92% with the error above. But then continuing with those 3 lines commented out works now. I will try building on my mac with those lines commented out.
Confirmed: I no longer need those three lines in freezify.py on my mac version. I assume because of something you changed in webgl-port.
One other odd thing. On linux, the library files are .bc instead of .o. Why? Emscripten behaves differently on linux and mac (which is linux under the covers)? Maybe a change to emscripten between last week and this week?
My version of freezify.py doesn’t care, because instead of listing all the panda3d modules and appending .bc or .o, I just do a listing of the embuilt/lib directory and add all of them, whatever is there. Perhaps not efficient, but doesn’t seem to make an unmanageable download.
So I think overall I have shown that my script works for building at least my app on OSX and linux. If I get a chance, I can do it on Windows and mark up any changes, but meanwhile, my script is:
Are you sure you have the latest version of the webgl-port branch? A couple of weeks ago I made the change to makepanda to use .o instead of .bc files. I also changed the linkage of the init_libpnmimagetypes function. So this would suggest you don’t have those changes.
I downloaded the zip file right before the build. I will start again. It does behave like the old one. Is it possible the zip is not updated? I can’t see how, but I definitely downloaded the zip right before the build.
Very sorry, I assumed the .zip would be up to date. Wasted a lot of your time, sorry.
Worked fine now on both mac and linux, though on both I had to again replace embuilt/tmp/libp3collide_igate.cxx after the initial error. Even after emsdk install latest and emsdk activate latest.
I have changed the directions in the script to use git clone --branch instead of the zip file.
The image load is much faster!
BTW, when emscripten installs, it says it is using python 3.7.4. Is that where the compatibility issue is? Should we be using that version of python, or is that a red herring?
Oddly, in linux, with the new code (using git clone --branch) I get this error (after fixing the libp3collide_igate problem):
embuilt/tmp/parser.yxx.c:256:10: fatal error: ‘parser.yxx.h’ file not found #include “parser.yxx.h”
I built from scratch twice just to be sure. Never got that on the mac. The linux laptop is old and very slow but ubuntu 20.04.2 installed just 2 weeks ago.
That’s weird… The zip file should be kept up-to-date by GitHub. In any case, the git command should be more reliable (and it’s easier to update afterwards).
I don’t think the version of Python used in emscripten itself matters.
As for the parser.yxx.c file, I’m not sure, it’s a little strange. Try making sure you have flex and bison installed. If that doesn’t help, please give me more of the output.
Could you send me the broken version of libp3collide_igate.cxx ? My suspicion is still an old version of interrogate being installed on the host, though—do you have multiple copies of Panda3D installed, perhaps?
It looks like the error is caused by not having flex or bison installed, and you may need to delete the embuilt/tmp/parser.yxx* files and embuilt/tmp/p3egg_lexer.o and embuilt/tmp/p3egg_parser.o to get it to force it to regenerate the files after installing flex.