1. 15 Nov, 2018 1 commit
  2. 11 Nov, 2018 2 commits
    • Kirill Smelkov's avatar
      Deactivate __attribute__(ctor) workaround · bed54e91
      Kirill Smelkov authored
      Linking gets broken:
      
      wasm@deco:~/trydynlib$ make test-js
      make[1]: Цель «all» не требует выполнения команд.
      (cd js && node prog.js)
      prog!
      external function 'ffunc1' is missing. perhaps a side module was not linked in? if this function was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment
      external function 'ffunc1' is missing. perhaps a side module was not linked in? if this function was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment
      exception thrown: abort("external function 'ffunc1' is missing. perhaps a side module was not linked in? if this function was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment") at Error
          at jsStackTrace (/home/wasm/trydynlib/js/prog.js:1137:13)
          at stackTrace (/home/wasm/trydynlib/js/prog.js:1154:12)
          at abort (/home/wasm/trydynlib/js/prog.js:106480:44)
          at _ffunc1 (eval at loadDynamicLibrary (/home/wasm/trydynlib/js/prog.js:332:15), <anonymous>:58:33)
          at _kfunc1 (eval at loadDynamicLibrary (/home/wasm/trydynlib/js/prog.js:332:15), <anonymous>:192:2)
          at asm._kfunc1 (eval at loadDynamicLibrary (/home/wasm/trydynlib/js/prog.js:332:15), <anonymous>:213:23)
          at _kfunc1 (/home/wasm/trydynlib/js/prog.js:7566:278)
          at _main (/home/wasm/trydynlib/js/prog.js:30439:8)
          at Object.asm._main (/home/wasm/trydynlib/js/prog.js:105733:21)
          at Object.callMain (/home/wasm/trydynlib/js/prog.js:106310:30)
      
      make: *** [Makefile:10: test-js] Ошибка 1
      wasm@deco:~/trydynlib$ make test-wasm
      make[1]: Цель «all» не требует выполнения команд.
      (cd wasm && node prog.js)
      prog!
      Assertion failed: missing linked function _ffunc1
      Assertion failed: missing linked function _ffunc1
      exception thrown: abort("Assertion failed: missing linked function _ffunc1") at Error
          at jsStackTrace (/home/wasm/trydynlib/wasm/prog.js:1281:13)
          at stackTrace (/home/wasm/trydynlib/wasm/prog.js:1298:12)
          at abort (/home/wasm/trydynlib/wasm/prog.js:30517:44)
          at assert (/home/wasm/trydynlib/wasm/prog.js:679:5)
          at env.(anonymous function) (/home/wasm/trydynlib/wasm/prog.js:446:9)
          at wasm-function[7]:7
          at _kfunc1 (/home/wasm/trydynlib/wasm/prog.js:8010:278)
          at wasm-function[144]:54
          at Object.Module._main (/home/wasm/trydynlib/wasm/prog.js:29885:33)
          at Object.callMain (/home/wasm/trydynlib/wasm/prog.js:30347:30)
      make: *** [Makefile:10: test-wasm] Ошибка 1
      bed54e91
    • Kirill Smelkov's avatar
      Build both js and wasm at the same time · a7fb7445
      Kirill Smelkov authored
      a7fb7445
  3. 09 Nov, 2018 1 commit
  4. 07 Nov, 2018 20 commits
    • Kirill Smelkov's avatar
      . · ee35d772
      Kirill Smelkov authored
      ee35d772
    • Kirill Smelkov's avatar
    • Kirill Smelkov's avatar
      EM_ASM does not work for wasm · 6f553601
      Kirill Smelkov authored
      wasm@deco:~/trydynlib$ make
      emcc -s WASM=1 -s SIDE_MODULE=1 -DLIBF_COMPILE -o libf_so.wasm libf.c
      emcc -s WASM=1 -s SIDE_MODULE=1 -s RUNTIME_LINKED_LIBS="['libf_so.wasm']" -DLIBK_COMPILE -o libk_so.wasm libk.c
      warning: unexpected number of arguments 0 in call to 'ffunc1', should be 1
      Traceback (most recent call last):
        File "/home/wasm/emsdk/emscripten/1.38.16/emcc.py", line 3107, in <module>
          sys.exit(run())
        File "/home/wasm/emsdk/emscripten/1.38.16/emcc.py", line 1820, in run
          final = shared.Building.emscripten(final, append_ext=False, extra_args=extra_args)
        File "/home/wasm/emsdk/emscripten/1.38.16/tools/shared.py", line 2289, in emscripten
          emscripten._main(cmdline)
        File "/home/wasm/emsdk/emscripten/1.38.16/emscripten.py", line 2372, in _main
          return temp_files.run_and_clean(lambda: main(
        File "/home/wasm/emsdk/emscripten/1.38.16/tools/tempfiles.py", line 98, in run_and_clean
          return func()
        File "/home/wasm/emsdk/emscripten/1.38.16/emscripten.py", line 2377, in <lambda>
          DEBUG=DEBUG,
        File "/home/wasm/emsdk/emscripten/1.38.16/emscripten.py", line 2303, in main
          temp_files=temp_files, DEBUG=DEBUG)
        File "/home/wasm/emsdk/emscripten/1.38.16/emscripten.py", line 101, in emscript
          function_tables_and_exports(funcs, metadata, mem_init, glue, forwarded_data, outfile, DEBUG))
        File "/home/wasm/emsdk/emscripten/1.38.16/emscripten.py", line 260, in function_tables_and_exports
          pre = include_asm_consts(pre, forwarded_json, metadata)
        File "/home/wasm/emsdk/emscripten/1.38.16/emscripten.py", line 711, in include_asm_consts
          assert len(metadata['asmConsts']) == 0, 'EM_ASM is not yet supported in shared wasm module (it cannot be stored in the wasm itself, need some solution)'
      AssertionError: EM_ASM is not yet supported in shared wasm module (it cannot be stored in the wasm itself, need some solution)
      6f553601
    • Kirill Smelkov's avatar
      __attribute__(constructor) actually works · 721c9332
      Kirill Smelkov authored
      wasm@deco:~/trydynlib$ make -B
      emcc -s WASM=0 -s SIDE_MODULE=1 -DLIBF_COMPILE -o libf_so.js libf.c
      emcc -s WASM=0 -s SIDE_MODULE=1 -s RUNTIME_LINKED_LIBS="['libf_so.js']" -DLIBK_COMPILE -o libk_so.js libk.c
      warning: unexpected number of arguments 0 in call to 'ffunc1', should be 1
      emcc -s WASM=0 -s MAIN_MODULE=1 -s RUNTIME_LINKED_LIBS="['libk_so.js']" -o prog.js prog.c
      warning: unexpected number of arguments 0 in call to 'kfunc1', should be 1
      
      wasm@deco:~/trydynlib$ node prog.js
      prog!
      libf.ffunc1
      libk.kfunc1 -> 12
      721c9332
    • Kirill Smelkov's avatar
      In C++ it worked · 3bdad7bf
      Kirill Smelkov authored
      wasm@deco:~/trydynlib$ make -B
      emcc -s WASM=0 -s SIDE_MODULE=1 -DLIBF_COMPILE -o libf_so.js libf.c
      emcc -s WASM=0 -s SIDE_MODULE=1 -s RUNTIME_LINKED_LIBS="['libf_so.js']" -DLIBK_COMPILE -o libk_so.js libk.cpp
      emcc -s WASM=0 -s MAIN_MODULE=1 -s RUNTIME_LINKED_LIBS="['libk_so.js']" -o prog.js prog.c
      warning: unexpected number of arguments 0 in call to 'kfunc1', should be 1
      
      wasm@deco:~/trydynlib$ node prog.js
      prog!
      libf.ffunc1
      libk.kfunc1 -> 12
      3bdad7bf
    • Kirill Smelkov's avatar
      __attribute__(constructor) did not work · c739465b
      Kirill Smelkov authored
      init() is not called on libk load.
      c739465b
    • Kirill Smelkov's avatar
      Linking libk -> libf (via RUNTIME_LINKED_LIBS) did not work · 76b7f605
      Kirill Smelkov authored
      wasm@deco:~/trydynlib$ make -B
      emcc -s WASM=0 -s SIDE_MODULE=1 -DLIBF_COMPILE -o libf_so.js libf.c
      emcc -s WASM=0 -s SIDE_MODULE=1 -s RUNTIME_LINKED_LIBS="['libf_so.js']" -DLIBK_COMPILE -o libk_so.js libk.c
      warning: unexpected number of arguments 0 in call to 'ffunc1', should be 1
      emcc -s WASM=0 -s MAIN_MODULE=1 -s RUNTIME_LINKED_LIBS="['libk_so.js']" -o prog.js prog.c
      warning: unexpected number of arguments 0 in call to 'kfunc1', should be 1
      
      wasm@deco:~/trydynlib$ node prog.js
      prog!
      external function 'ffunc1' is missing. perhaps a side module was not linked in? if this function was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment
      external function 'ffunc1' is missing. perhaps a side module was not linked in? if this function was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment
      exception thrown: abort("external function 'ffunc1' is missing. perhaps a side module was not linked in? if this function was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment") at Error
          at jsStackTrace (/home/wasm/trydynlib/prog.js:1135:13)
          at stackTrace (/home/wasm/trydynlib/prog.js:1152:12)
          at abort (/home/wasm/trydynlib/prog.js:106462:44)
          at _ffunc1 (eval at loadDynamicLibrary (/home/wasm/trydynlib/prog.js:330:15), <anonymous>:58:33)
          at _kfunc1 (eval at loadDynamicLibrary (/home/wasm/trydynlib/prog.js:330:15), <anonymous>:192:2)
          at asm._kfunc1 (eval at loadDynamicLibrary (/home/wasm/trydynlib/prog.js:330:15), <anonymous>:213:23)
          at _kfunc1 (/home/wasm/trydynlib/prog.js:7564:278)
          at _main (/home/wasm/trydynlib/prog.js:30421:8)
          at Object.asm._main (/home/wasm/trydynlib/prog.js:105715:21)
          at Object.callMain (/home/wasm/trydynlib/prog.js:106292:30)
      76b7f605
    • Kirill Smelkov's avatar
      libk calls -> libf but for libf is linked by main (for now?) · 462cb27f
      Kirill Smelkov authored
      wasm@deco:~/trydynlib$ make -B
      emcc -s WASM=0 -s SIDE_MODULE=1 -DLIBF_COMPILE -o libf_so.js libf.c
      emcc -s WASM=0 -s SIDE_MODULE=1 -DLIBK_COMPILE -o libk_so.js libk.c
      warning: unexpected number of arguments 0 in call to 'ffunc1', should be 1
      emcc -s WASM=0 -s MAIN_MODULE=1 -s RUNTIME_LINKED_LIBS="['libk_so.js', 'libf_so.js']" -o prog.js prog.c
      warning: unexpected number of arguments 0 in call to 'kfunc1', should be 1
      
      wasm@deco:~/trydynlib$ node prog.js
      prog!
      libf.ffunc1
      libk.kfunc1 -> 12
      462cb27f
    • Kirill Smelkov's avatar
      Back to default -O0 · a63a840f
      Kirill Smelkov authored
      a63a840f
    • Kirill Smelkov's avatar
      -O1 · 1d7443ef
      Kirill Smelkov authored
      wasm@deco:~/trydynlib$ make -B
      emcc -s WASM=0 -O1 -s SIDE_MODULE=1 -DLIBK_COMPILE -o libk_so.js libk.c
      emcc -s WASM=0 -O1 -s MAIN_MODULE=1 -s RUNTIME_LINKED_LIBS="['libk_so.js']" -o prog.js prog.c
      
      wasm@deco:~/trydynlib$ node prog.js
      prog!
      libk.kfunc1 -> 12
      1d7443ef
    • Kirill Smelkov's avatar
      Switch back wasm -> js · 8b6885f5
      Kirill Smelkov authored
      8b6885f5
    • Kirill Smelkov's avatar
      Linking in wasm mode also works · 102d2a47
      Kirill Smelkov authored
      wasm@deco:~/trydynlib$ make
      emcc -s WASM=1 -s SIDE_MODULE=1 -DLIBK_COMPILE -o libk_so.wasm libk.c
      emcc -s WASM=1 -s MAIN_MODULE=1 -s RUNTIME_LINKED_LIBS="['libk_so.wasm']" -o prog.js prog.c
      warning: unexpected number of arguments 0 in call to 'kfunc1', should be 1
      
      wasm@deco:~/trydynlib$ ll
      итого 4128
      -rw-r--r-- 1 wasm wasm     352 ноя  7 17:45 dso.h
      -rw-r--r-- 1 wasm wasm      56 ноя  7 17:26 libk.c
      -rw-r--r-- 1 wasm wasm     171 ноя  7 17:32 libk.h
      -rw-r--r-- 1 wasm wasm     507 ноя  7 17:47 libk_so.wasm
      -rw-r--r-- 1 wasm wasm     355 ноя  7 17:46 Makefile
      -rw-r--r-- 1 wasm wasm 2335565 ноя  7 17:47 prog.asm.js
      -rw-r--r-- 1 wasm wasm     144 ноя  7 17:00 prog.c
      -rw-r--r-- 1 wasm wasm 1215347 ноя  7 17:47 prog.js
      -rw-r--r-- 1 wasm wasm  645467 ноя  7 17:47 prog.wasm
      
      wasm@deco:~/trydynlib$ node prog.js
      prog!
      libk.kfunc1 -> 12
      102d2a47
    • Kirill Smelkov's avatar
      linking to libk_so works · 1ec95cd5
      Kirill Smelkov authored
      wasm@deco:~/trydynlib$ node prog.js
      prog!
      libk.kfunc1 -> 12
      1ec95cd5
    • Kirill Smelkov's avatar
      libk.kfunc1 was not exported · 36f52cc1
      Kirill Smelkov authored
      wasm@deco:~/trydynlib$ node prog.js
      loading libk_so.js
      symbol arguments
      symbol cleanups
      symbol asmGlobalArg
      symbol asmLibraryArg
      symbol runPostSets
      symbol setThrew
      symbol NAMED_GLOBALS
      prog!
      36f52cc1
    • Kirill Smelkov's avatar
      Try to autoload libk · b9dd7c13
      Kirill Smelkov authored
      Still the same:
      
      wasm@deco:~/trydynlib$ node prog.js
      prog!
      external function 'kfunc1' is missing. perhaps a side module was not linked in? if this function was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment
      external function 'kfunc1' is missing. perhaps a side module was not linked in? if this function was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment
      exception thrown: abort("external function 'kfunc1' is missing. perhaps a side module was not linked in? if this function was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment") at Error
          at jsStackTrace (/home/wasm/trydynlib/prog.js:1135:13)
          at stackTrace (/home/wasm/trydynlib/prog.js:1152:12)
          at abort (/home/wasm/trydynlib/prog.js:106462:44)
          at _kfunc1 (/home/wasm/trydynlib/prog.js:7564:27)
          at _main (/home/wasm/trydynlib/prog.js:30421:8)
          at Object.asm._main (/home/wasm/trydynlib/prog.js:105715:21)
          at Object.callMain (/home/wasm/trydynlib/prog.js:106292:30)
          at doRun (/home/wasm/trydynlib/prog.js:106350:60)
          at run (/home/wasm/trydynlib/prog.js:106364:5)
          at Object.<anonymous> (/home/wasm/trydynlib/prog.js:106487:1)
      b9dd7c13
    • Kirill Smelkov's avatar
      (build) · c2cd1a06
      Kirill Smelkov authored
      wasm@deco:~/trydynlib$ make
      
      emcc -s WASM=0 -s SIDE_MODULE=1 -DLIBK_COMPILE -o libk_so.js libk.c
      emcc -s WASM=0 -s MAIN_MODULE=1 -o prog.js prog.c
      warning: unexpected number of arguments 0 in call to 'kfunc1', should be 1
      
      wasm@deco:~/trydynlib$ node prog.js
      prog!
      external function 'kfunc1' is missing. perhaps a side module was not linked in? if this function was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment
      external function 'kfunc1' is missing. perhaps a side module was not linked in? if this function was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment
      exception thrown: abort("external function 'kfunc1' is missing. perhaps a side module was not linked in? if this function was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment") at Error
          at jsStackTrace (/home/wasm/trydynlib/prog.js:1135:13)
          at stackTrace (/home/wasm/trydynlib/prog.js:1152:12)
          at abort (/home/wasm/trydynlib/prog.js:106460:44)
          at _kfunc1 (/home/wasm/trydynlib/prog.js:7562:27)
          at _main (/home/wasm/trydynlib/prog.js:30419:8)
          at Object.asm._main (/home/wasm/trydynlib/prog.js:105713:21)
          at Object.callMain (/home/wasm/trydynlib/prog.js:106290:30)
          at doRun (/home/wasm/trydynlib/prog.js:106348:60)
          at run (/home/wasm/trydynlib/prog.js:106362:5)
          at Object.<anonymous> (/home/wasm/trydynlib/prog.js:106485:1)
      c2cd1a06
    • Kirill Smelkov's avatar
      . · de92a18b
      Kirill Smelkov authored
      de92a18b
    • Kirill Smelkov's avatar
      . · 5f925a65
      Kirill Smelkov authored
      5f925a65
    • Kirill Smelkov's avatar
      . · 4d471fb3
      Kirill Smelkov authored
      4d471fb3
    • Kirill Smelkov's avatar
      . · aef1076a
      Kirill Smelkov authored
      aef1076a