[Pkg-javascript-devel] Bug#1005294: Emscripten attempts to run invalid closure-compiler command

Jeremy James jeremy.james at gmail.com
Thu Feb 10 18:00:26 GMT 2022


Package: emscripten
Version: 3.1.3~dfsg-4

If emcc is run with --closure 1 then you receive an error that the
command '--max_old_space_size=8192' is invalid.

In fact, it attempts to run a command starting:
--max_old_space_size=8192 closure-compiler --compilation_level ...

Which appears to be caused by the 2009_closure-compiler.patch Debian
patch that modifies tools/building.py to create the following
function:

--
def get_closure_compiler():
  # First check if the user configured a specific CLOSURE_COMPILER in
thier settings
  if config.CLOSURE_COMPILER:
    return config.CLOSURE_COMPILER

  # Otherwise use the system-shared one
  cmd = ['closure-compiler']
  if not WINDOWS:
    # Work around an issue that Closure compiler can take up a lot of
memory and crash in an error
    # "FATAL ERROR: Ineffective mark-compacts near heap limit
Allocation failed - JavaScript heap
    # out of memory"
    cmd.insert(-1, '--max_old_space_size=8192')
  return cmd
--

Which results in the invalid return value of
['--max_old_space_size=8192', 'closure-compiler']

Since max_old_space_size is a nodejs parameter that would have been
inserted into the return value of
shared.get_npm_cmd('google-closure-compiler'), I would suggest
removing the 'if not WINDOWS' section condition altogether in this
patch.

A workaround is to set CLOSURE_COMPILER, except there was a separate
upstream bug that broke this until recently [1].

[1] https://github.com/emscripten-core/emscripten/pull/15008



More information about the Pkg-javascript-devel mailing list