poly-flif
poly-flif copied to clipboard
Build Error
I ran emmake make, as suggested by the README, but I got an error. I guess it has to do with libpng. So, I installed libpng with: sudo apt-get install libpng-dev. But, I still got this error.
make: pkg-config: Command not found
make: pkg-config: Command not found
make: pkg-config: Command not found
.../emsdk/emscripten/1.37.37/em++.py -c -std=gnu++11 -DLODEPNG_NO_COMPILE_PNG -DLODEPNG_NO_COMPILE_DISK -DNDEBUG -O2 -ftree-vectorize -g0 -Wall -fPIC -o image/image-png.o image/image-png.cpp
image/image-png.cpp:18:10: fatal error: 'png.h' file not found
#include <png.h>
^~~~~~~
1 error generated.
ERROR:root:compiler frontend failed to generate LLVM bitcode, halting
Makefile:41: recipe for target 'image/image-png.o' failed
make: *** [image/image-png.o] Error 1
I ran emmake make -f Makefile-emscript, and it fails with this error:
Traceback (most recent call last):
File ".../emsdk/emscripten/1.37.37/em++", line 15, in <module>
python_selector.run(emcc, profile=True)
File ".../emsdk/emscripten/1.37.37/tools/python_selector.py", line 38, in run
sys.exit(run_by_import(filename, main) if on_allowed_version() else run_by_subprocess(filename))
File ".../emsdk/emscripten/1.37.37/tools/python_selector.py", line 13, in run_by_import
return getattr(importlib.import_module(os.path.basename(filename)), main)()
File ".../emsdk/emscripten/1.37.37/emcc.py", line 1864, in run
optimizer.flush()
File ".../emsdk/emscripten/1.37.37/emcc.py", line 241, in flush
self.run_passes(chunks[0], title, just_split=False, just_concat=False)
File ".../emsdk/emscripten/1.37.37/emcc.py", line 276, in run_passes
output_filename=self.in_temp(os.path.basename(final) + '.jsopted.js'))
File ".../emsdk/emscripten/1.37.37/tools/shared.py", line 2079, in js_optimizer
ret = js_optimizer.run(filename, passes, NODE_JS, debug, extra_info, just_split, just_concat)
File ".../emsdk/emscripten/1.37.37/tools/js_optimizer.py", line 557, in run
return temp_files.run_and_clean(lambda: run_on_js(filename, passes, js_engine, source_map, extra_info, just_split, just_concat))
File ".../emsdk/emscripten/1.37.37/tools/tempfiles.py", line 93, in run_and_clean
return func()
File ".../emsdk/emscripten/1.37.37/tools/js_optimizer.py", line 557, in <lambda>
return temp_files.run_and_clean(lambda: run_on_js(filename, passes, js_engine, source_map, extra_info, just_split, just_concat))
File ".../emsdk/emscripten/1.37.37/tools/js_optimizer.py", line 492, in run_on_js
cld = shared.Building.closure_compiler(cld, pretty='minifyWhitespace' not in passes)
File ".../emsdk/emscripten/1.37.37/tools/shared.py", line 2211, in closure_compiler
raise Exception('closure compiler error: ' + process.stdout + ' (rc: %d)' % process.returncode)
Exception: closure compiler error: .../emsdk/emscripten/1.37.37/third_party/closure-compiler/node-externs/domain.js:67: WARNING - Bad type annotation. type not recognized due to syntax error. See https://github.com/google/closure-compiler/wiki/Bad-Type-Annotation for more information.
* @param {function(...[*])} callback
^
.../emsdk/emscripten/1.37.37/third_party/closure-compiler/node-externs/domain.js:68: WARNING - Bad type annotation. type not recognized due to syntax error. See https://github.com/google/closure-compiler/wiki/Bad-Type-Annotation for more information.
* @return {function(...[*])}
^
.../emsdk/emscripten/1.37.37/third_party/closure-compiler/node-externs/domain.js:73: WARNING - Bad type annotation. type not recognized due to syntax error. See https://github.com/google/closure-compiler/wiki/Bad-Type-Annotation for more information.
* @param {function(...[*])} callback
^
.../emsdk/emscripten/1.37.37/third_party/closure-compiler/node-externs/domain.js:74: WARNING - Bad type annotation. type not recognized due to syntax error. See https://github.com/google/closure-compiler/wiki/Bad-Type-Annotation for more information.
* @return {function(...[*])}
^
/tmp/tmp_I1XS8.cl.js:4323: ERROR - variable PolyFlif is undeclared
var pf = new PolyFlif({"buf": content, "canvas": elem});
^^^^^^^^
1 error(s), 4 warning(s)
(rc: 1)
Makefile-emscript:49: recipe for target 'em-out/flif.html' failed
make: *** [em-out/flif.html] Error 1
emmake make -f Makefile-emscript
is the correct command. I have updated the README.
Compilation works for me with emsdk version sdk-1.37.9-64bit
. There are many versions with regressions listed here. Can you try either upgrading to 1.37.40
or downgrading to 1.37.9
?
Ok, I will try with 1.37.9. But, first I felt like trying to build with the latest emsdk version, and that doesn't work either. Also, wouldn't it be a good thing to get the build to work with the latest emsdk?
Stack: Error
at assertTrue (eval at globalEval (/.../emsdk/emscripten/1.38.11/tools/js-optimizer.js:114:8), <anonymous>:59:26)
at Object.emitDCEGraph (/.../emsdk/emscripten/1.38.11/tools/js-optimizer.js:8182:3)
at /.../emsdk/emscripten/1.38.11/tools/js-optimizer.js:8406:14
at Array.forEach (<anonymous>)
at Object.<anonymous> (/.../emsdk/emscripten/1.38.11/tools/js-optimizer.js:8405:21)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
undefined:60
throw msg;
^
Assertion failed: could not find the assigment to "asmLibraryArg". perhaps --pre-js or --post-js code moved it out of the global scope? (things like that should be done after emcc runs, as they do not need to be run through the optimizer which is the special thing about --pre-js/--post-js code)
Traceback (most recent call last):
File "/.../emsdk/emscripten/1.38.11/emcc.py", line 3042, in <module>
sys.exit(run())
File "/.../emsdk/emscripten/1.38.11/emcc.py", line 2030, in run
wasm_text_target, misc_temp_files, optimizer)
File "/.../emsdk/emscripten/1.38.11/emcc.py", line 2578, in do_binaryen
emit_symbol_map=emit_symbol_map)
File "/.../emsdk/emscripten/1.38.11/tools/shared.py", line 2505, in minify_wasm_js
js_file = Building.metadce(js_file, wasm_file, minify_whitespace=minify_whitespace, debug_info=debug_info)
File "/.../emsdk/emscripten/1.38.11/tools/shared.py", line 2525, in metadce
txt = Building.js_optimizer_no_asmjs(js_file, ['emitDCEGraph', 'noEmitAst'], return_output=True)
File "/.../emsdk/emscripten/1.38.11/tools/shared.py", line 2368, in js_optimizer_no_asmjs
return run_process(NODE_JS + [js_optimizer.JS_OPTIMIZER, filename] + passes, stdout=PIPE).stdout
File "/.../emsdk/emscripten/1.38.11/tools/shared.py", line 167, in run_process
return run_base(cmd, universal_newlines=universal_newlines, check=check, *args, **kw)
File "/.../emsdk/emscripten/1.38.11/tools/shared.py", line 162, in run_base
result.check_returncode()
File "/.../emsdk/emscripten/1.38.11/tools/shared.py", line 148, in check_returncode
raise Py2CalledProcessError(returncode=self.returncode, cmd=self.args, output=self.stdout, stderr=self.stderr)
tools.shared.Py2CalledProcessError: Command '['/.../emsdk/node/8.9.1_64bit/bin/node', '/.../emsdk/emscripten/1.38.11/tools/js-optimizer.js', '/tmp/tmpTa6Pg_/flif.bc.o.js.pp.js.mem.js.jso.js', 'emitDCEGraph', 'noEmitAst']' returned non-zero exit status 1
Makefile-emscript:49: recipe for target 'em-out/flif.html' failed
make: *** [em-out/flif.html] Error 1
The latest emsdk uses wasm by default. We will need to disable wasm build (for now) and make some other changes. See the comments here and here.
I am not actively maintaining this project right now. Although, if you make a PR, I will happily review and merge it.
Ok thanks for the info. Well, I would want to make those changes to get the WASM build to work. But, I need to figure out whether your repo or saschanaz's libflif is more promising to make FLIF on the web viable more quickly.
So, I tried to build with 1.37.40 and I get the same error
/tmp/tmp_I1XS8.cl.js:4323: ERROR - variable PolyFlif is undeclared var pf = new PolyFlif({"buf": content, "canvas": elem});
I suggest trying with 1.37.9 and if that works, atleast you will have a starting point. From that point, you can try going up the versions till it fails, and by looking at the change log for the failing sdk version, you will get a hint of how to fix this.