Skip to content

Commit

Permalink
Fix emscripten bug.
Browse files Browse the repository at this point in the history
Compilation to web target is currently failing with the following bug
(debug lines obtained with EMCC_DEBUG=1):

make raylib_game
make[1]: Entering directory '/home/fcasas/Music/nokia-pod-racer/src'
emcc -o raylib_game.html  raylib_game.o  screen_logo.o  screen_title.o  screen_options.o  screen_gameplay.o  screen_ending.o -std=c99 -Wall -Wno-missing-braces -Wunused-result -D_DEFAULT_SOURCE -Os -s MINIFY_HTML=0 -I. -I/home/fcasas/Videos/raylib-web/src -I/home/fcasas/Videos/raylib-web/src/external -I/home/fcasas/Videos/raylib-web/src/extras -L. -L/home/fcasas/Videos/raylib-web/src -L/home/fcasas/Videos/raylib-web/src -s USE_GLFW=3 -s TOTAL_MEMORY=134217728 -s FORCE_FILESYSTEM=1 --preload-file resources --shell-file minshell.html /home/fcasas/Videos/raylib-web/src/libraylib.a -DPLATFORM_WEB
...
emcc:DEBUG: minifying HTML file raylib_game.html
profiler:DEBUG: block "final emitting" raised an exception after 0.066 seconds
profiler:DEBUG: block "post_link" raised an exception after 3.469 seconds
profiler:DEBUG: block "main" raised an exception after 3.653 seconds
Traceback (most recent call last):
  File "/usr/share/emscripten/emcc.py", line 3929, in <module>
    sys.exit(main(sys.argv))
  File "/usr/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/usr/share/emscripten/emcc.py", line 3922, in main
    ret = run(args)
  File "/usr/share/emscripten/emcc.py", line 1194, in run
    phase_post_link(options, state, wasm_target, wasm_target, target)
  File "/usr/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/usr/share/emscripten/emcc.py", line 2740, in phase_post_link
    phase_final_emitting(options, state, target, wasm_target, memfile)
  File "/usr/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/usr/share/emscripten/emcc.py", line 2867, in phase_final_emitting
    generate_html(target, options, js_target, target_basename,
  File "/usr/share/emscripten/emcc.py", line 3663, in generate_html
    minify_html(target)
  File "/usr/share/emscripten/emcc.py", line 3637, in minify_html
    shared.check_call(['htmlmin', opts, '--', filename, filename])
  File "/usr/share/emscripten/tools/shared.py", line 221, in check_call
    return run_process(cmd, *args, **kw)
  File "/usr/share/emscripten/tools/shared.py", line 105, in run_process
    ret = subprocess.run(cmd, check=check, input=input, *args, **kw)
  File "/usr/lib/python3.10/subprocess.py", line 501, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.10/subprocess.py", line 969, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.10/subprocess.py", line 1778, in _execute_child
    self.pid = _posixsubprocess.fork_exec(
TypeError: expected str, bytes or os.PathLike object, not list

This seems related to this bug in emscripten:

emscripten-core/emscripten#10551

The solution is doing the same as in:

emscripten-core/emscripten#8547

adding the following compilation flag:

CFLAGS += -s MINIFY_HTML=0
  • Loading branch information
autopawn committed Feb 26, 2023
1 parent 100469b commit 6ce8d7c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ else
else
CFLAGS += -Os
endif
CFLAGS += -s MINIFY_HTML=0
else
CFLAGS += -s -O2
endif
Expand Down

0 comments on commit 6ce8d7c

Please sign in to comment.