Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register
  • Index
  • » Users
  • » thierry2016
  • » Profile

Posts

Posts

Jul-28-16 14:30:58
emscripten setup
Category: Developer

"apt-get install emscripten" is a bad idea. It is required to install emscripten as described in the portable version, or some things will be missing.
The compilation now goes further and halts on a error in parse-js.js:

"
emsdk_portable/emscripten/master/tools/eliminator/node_modules/uglify-js/lib/parse-js.js:272
        throw new JS_Parse_Error(message, line, col, pos);
        ^
TypeError: (intermediate value) is not a function
    at new JS_Parse_Error (emsdk_portable/emscripten/master/tools/eliminator/node_modules/uglify-js/lib/parse-js.js:261:21)
    at js_error (emsdk_portable/emscripten/master/tools/eliminator/node_modules/uglify-js/lib/parse-js.js:272:15)
    at croak (emsdk_portable/emscripten/master/tools/eliminator/node_modules/uglify-js/lib/parse-js.js:742:17)
    at token_error (emsdk_portable/emscripten/master/tools/eliminator/node_modules/uglify-js/lib/parse-js.js:749:17)
    at unexpected (emsdk_portable/emscripten/master/tools/eliminator/node_modules/uglify-js/lib/parse-js.js:755:17)
    at block_ (emsdk_portable/emscripten/master/tools/eliminator/node_modules/uglify-js/lib/parse-js.js:998:40)
    at emsdk_portable/emscripten/master/tools/eliminator/node_modules/uglify-js/lib/parse-js.js:978:43
    at emsdk_portable/emscripten/master/tools/eliminator/node_modules/uglify-js/lib/parse-js.js:982:29
    at emsdk_portable/emscripten/master/tools/eliminator/node_modules/uglify-js/lib/parse-js.js:1112:43
    at maybe_unary (emsdk_portable/emscripten/master/tools/eliminator/node_modules/uglify-js/lib/parse-js.js:1209:27)
Traceback (most recent call last):
  File "emsdk_portable/emscripten/master/emcc", line 13, in <module>
    emcc.run()
  File "emsdk_portable/emscripten/master/emcc.py", line 1668, in run
    JSOptimizer.flush()
  File "emsdk_portable/emscripten/master/emcc.py", line 1573, in flush
    run_passes(chunks[i], 'js_opts_' + str(i), just_split='receiveJSON' in chunks[i], just_concat='emitJSON' in chunks[i])
  File "emsdk_portable/emscripten/master/emcc.py", line 1543, in run_passes
    final = shared.Building.js_optimizer(final, passes, debug_level >= 4, JSOptimizer.extra_info, just_split=just_split, just_concat=just_concat)
  File "emsdk_portable/emscripten/master/tools/shared.py", line 1651, in js_optimizer
    ret = js_optimizer.run(filename, passes, NODE_JS, debug, extra_info, just_split, just_concat)
  File "emsdk_portable/emscripten/master/tools/js_optimizer.py", line 538, 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_portable/emscripten/master/tools/tempfiles.py", line 64, in run_and_clean
    return func()
  File "emsdk_portable/emscripten/master/tools/js_optimizer.py", line 538, 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_portable/emscripten/master/tools/js_optimizer.py", line 483, in run_on_js
    assert proc.returncode == 0
AssertionError
make: *** [omc_main_target] Erreur 1

Still looking...

Jul-28-16 14:24:08
emscripten setup
Category: Developer

finding the various lib*.s and putting them exactly in the directory "/usr/lib/x86_64-linux-gnu/omc/emcc" has reduced the number of problems.

There is now a message stating the production of the js file has failed because there is no target:

"emcc -I. -o Modelica.Electrical.Analog.Examples.ChuaCircuit.js Modelica.Electrical.Analog.Examples.ChuaCircuit.o Modelica.Electrical.Analog.Examples.ChuaCircuit_functions.o Modelica.Electrical.Analog.Examples.ChuaCircuit_records.o Modelica.Electrical.Analog.Examples.ChuaCircuit_01exo.o Modelica.Electrical.Analog.Examples.ChuaCircuit_02nls.o Modelica.Electrical.Analog.Examples.ChuaCircuit_03lsy.o Modelica.Electrical.Analog.Examples.ChuaCircuit_04set.o Modelica.Electrical.Analog.Examples.ChuaCircuit_05evt.o Modelica.Electrical.Analog.Examples.ChuaCircuit_06inz.o Modelica.Electrical.Analog.Examples.ChuaCircuit_07dly.o Modelica.Electrical.Analog.Examples.ChuaCircuit_08bnd.o Modelica.Electrical.Analog.Examples.ChuaCircuit_09alg.o Modelica.Electrical.Analog.Examples.ChuaCircuit_10asr.o Modelica.Electrical.Analog.Examples.ChuaCircuit_11mix.o Modelica.Electrical.Analog.Examples.ChuaCircuit_12jac.o Modelica.Electrical.Analog.Examples.ChuaCircuit_13opt.o Modelica.Electrical.Analog.Examples.ChuaCircuit_14lnz.o Modelica.Electrical.Analog.Examples.ChuaCircuit_15syn.o -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_EMCC -L"/usr/lib/omlibrary/Modelica 3.2.2/Electrical/Analog/Examples"     -Os -Wno-warn-absolute-paths    -L"/usr/lib/omlibrary/Modelica 3.2.2/Electrical/Analog/Examples" -L'/usr/lib/x86_64-linux-gnu/omc/emcc' -lblas -llapack -lexpat -lSimulationRuntimeC -s TOTAL_MEMORY=805306368 -s OUTLINING_LIMIT=20000 --pre-js /usr/lib/x86_64-linux-gnu/omc/emcc/pre.js
INFO     root: =======================================
INFO     root: bootstrapping relooper...
INFO     root:   bootstrap phase 1
/home/tcoq/emsdk_portable/clang/fastcomp/build_master_64/bin/lli: error creating EE: No available targets are compatible with this triple, see -version for the available targets.
FAIL: Running the generated program failed!
Traceback (most recent call last):
  File "/usr/share/emscripten/emcc", line 1864, in <module>
    final = shared.Building.emscripten(final, append_ext=False, extra_args=extra_args)
  File "/usr/share/emscripten/tools/shared.py", line 1276, in emscripten
    assert os.path.exists(filename + '.o.js') and len(open(filename + '.o.js', 'r').read()) > 0, 'Emscripten failed to generate .js: ' + str(compiler_output)
AssertionError: Emscripten failed to generate .js:
ERROR    root: bootstrapping relooper failed. You may need to manually create relooper.js by compiling it, see src/relooper/emscripten
Traceback (most recent call last):
  File "/usr/share/emscripten/emscripten.py", line 1352, in <module>
    _main(environ=os.environ)
  File "/usr/share/emscripten/emscripten.py", line 1340, in _main
    temp_files.run_and_clean(lambda: main(
  File "/usr/share/emscripten/tools/tempfiles.py", line 39, in run_and_clean
    return func()
  File "/usr/share/emscripten/emscripten.py", line 1348, in <lambda>
    DEBUG_CACHE=DEBUG_CACHE,
  File "/usr/share/emscripten/emscripten.py", line 1226, in main
    shared.Building.ensure_relooper(relooper)
  File "/usr/share/emscripten/tools/shared.py", line 1521, in ensure_relooper
    1/0
ZeroDivisionError: integer division or modulo by zero
Traceback (most recent call last):
  File "/usr/bin/emcc", line 1864, in <module>
    final = shared.Building.emscripten(final, append_ext=False, extra_args=extra_args)
  File "/usr/share/emscripten/tools/shared.py", line 1276, in emscripten
    assert os.path.exists(filename + '.o.js') and len(open(filename + '.o.js', 'r').read()) > 0, 'Emscripten failed to generate .js: ' + str(compiler_output)
AssertionError: Emscripten failed to generate .js:
make: *** [omc_main_target] Erreur 1
"

Anyone knows how to solve this?

Jul-28-16 13:55:18
emscripten setup
Category: Developer

In the log file, the "pre.js" is missing. It is being looked for in an absolute path: /usr/lib/x86_64-linux-gnu/omc/emcc.
I have copied the pre.js file there. Now the compile stops by not finding four libraries:

WARNING  root: memcc: cannot find library "blas"
WARNING  root: memcc: cannot find library "lapack"
WARNING  root: memcc: cannot find library "expat"
WARNING  root: memcc: cannot find library "SimulationRuntimeC"

It may be the compiled libraries are not found: the .so.

It seems one cannot use an OpenModelica installed with apt-get, but it needs to be compiled from sources, to get the compiled libraries in the right path.

Jul-28-16 13:41:52
emscripten setup
Category: Developer

Hi
I have the same issue. I tried both on Windows and on Linux. With both OpenModelica 1.9.3 and OpenModelica 1.9.6.

The _node.js file is generated, but the direct .js file is missing. It is required by the _node.js file:

"
var mod = require('./Modelica.Electrical.Analog.Examples.ChuaCircuit.js');
"
There is a direct C file: "Modelica.Electrical.Analog.Examples.ChuaCircuit.c"  but that is no use when trying to generate a javascript file. I have followed exactly all the steps to install OpenModelica and emscripten, on both Windows and Linux. Has anyone else seen the problem? Found a way around this problem?

Thank you for your help,

Thierry

  • Index
  • » Users
  • » thierry2016
  • » Profile
You are here: