Hi,
I'm trying to use the Debian package of emcc to build something that
is not a Debian package.
Well, if I used, say, gcc to compile some program I wrote myself,
and gcc failed with an internal compiler error, it would still be a
bug in gcc (possibly also a bug in my code, but definitely a bug in
gcc). Especially seeing that the message explicitly says:
Please report this as a bug against emscripten
Which I did.
Didn't help unfortunately.
I don't think sgt-puzzles expects any of this. In fact, their
sources don't mention babel at all ("grep -ie babel .").
To me it looks like babel is something interenally used by emcc
(to continue the example above, if the problem was in libgcc, it
would still be a bug in gcc plus its environment, not necessarily in
my code).
In fact, I grepped the sources of emscripten. The bookworm version
didn't mention babel at all, except for some comments like "At some
point we may want to look into using this as way to convert to ES5
but babel is perhaps a better tool for that.", whereas the trixie
version contains many references to babel. So it seems emscripten
made this change proposed in that comment, sometime between bookworm
and trixie, but it doesn't work. Whether it's just a missing
dependency or a deeper issue, I have no idea.
With "cmake --verbose", I see the failing command:
/usr/share/emscripten/emcc \
-fmacro-prefix-map=/tmp/sgt-puzzles-20250730.a7c7826=/puzzles \
-fmacro-prefix-map=/tmp/sgt-puzzles-20250730.a7c7826=/build -s \
ALLOW_MEMORY_GROWTH=1 -s ENVIRONMENT=web -s \
EXPORTED_FUNCTIONS='["_mouseup","_mousedown","_mousemove","_key","_timer_callback","_command","_get_text_format","_free_text_format","_get_save_file","_free_save_file","_load_game","_dlg_return_sval","_dlg_return_ival","_resize_puzzle","_restore_puzzle_size","_rescale_puzzle","_prefs_load_callback","_malloc","_free","_main"]' \
-s EXPORTED_RUNTIME_METHODS='[cwrap]' \
-s MIN_FIREFOX_VERSION=68 -s MIN_SAFARI_VERSION=150000 -s MIN_CHROME_VERSION=57 \
-s MIN_NODE_VERSION=0x7FFFFFFF -s STRICT_JS=1 -s WASM=1 -s WASM_BIGINT @CMakeFiles/bridges.dir/objects1.rsp -o bridges.js @CMakeFiles/bridges.dir/linkLibs.rsp
After some trial and error I found that it works if I remove this:
-s MIN_FIREFOX_VERSION=68 -s MIN_SAFARI_VERSION=150000 -s MIN_CHROME_VERSION=57 \
As I said, I don't know much about emscripten, just trying to use
it. From what I could google, it seems that it tries to transpile
the code to work with older browsers using babel, and that fails.
By removing these settings, it apparently won't do this, so the
generated code will probably only work on the newest browsers, like
half of the web anyway, so whatever ...