Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

can't make wasm #1166

Open
vaaaaanquish opened this issue Dec 18, 2020 · 9 comments · May be fixed by #1227
Open

can't make wasm #1166

vaaaaanquish opened this issue Dec 18, 2020 · 9 comments · May be fixed by #1227
Labels
Build build issue wasm

Comments

@vaaaaanquish
Copy link

Hi. I couldn't get WASM to work.

In local OSX.

$ docker pull emscripten/emsdk
$ docker run -it emscripten/emsdk bash

In Container.

$ em++ --version
emcc (Emscripten gcc/clang-like replacement) 2.0.11 (6e28e4fa4fa1bc50d58b9ddbbb9603a3cf21ea9e)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ git clone https://github.com/facebookresearch/fastText.git
$ cd fastText
$ make wasm

output:

callapsible

root@57269e14d141:/src/fastText# make wasm
em++ --bind --std=c++11 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun', 'FS']" -s "DISABLE_EXCEPTION_CATCHING=0" -s "EXCEPTION_DEBUG=1" -s "FORCE_FILESYSTEM=1" -s "MODULARIZE=1" -s "EXPORT_ES6=1" -s 'EXPORT_NAME="FastTextModule"' -Isrc/  src/args.cc -o args.bc
em++: warning: generating an executable with an object extension (.bc).  If you meant to build an object file please use `-c, `-r`, or `-shared` [-Wemcc]
em++ --bind --std=c++11 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun', 'FS']" -s "DISABLE_EXCEPTION_CATCHING=0" -s "EXCEPTION_DEBUG=1" -s "FORCE_FILESYSTEM=1" -s "MODULARIZE=1" -s "EXPORT_ES6=1" -s 'EXPORT_NAME="FastTextModule"' -Isrc/  src/autotune.cc -o autotune.bc
em++: warning: generating an executable with an object extension (.bc).  If you meant to build an object file please use `-c, `-r`, or `-shared` [-Wemcc]
em++ --bind --std=c++11 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun', 'FS']" -s "DISABLE_EXCEPTION_CATCHING=0" -s "EXCEPTION_DEBUG=1" -s "FORCE_FILESYSTEM=1" -s "MODULARIZE=1" -s "EXPORT_ES6=1" -s 'EXPORT_NAME="FastTextModule"' -Isrc/ src/matrix.cc -o matrix.bc
em++: warning: generating an executable with an object extension (.bc).  If you meant to build an object file please use `-c, `-r`, or `-shared` [-Wemcc]
em++ --bind --std=c++11 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun', 'FS']" -s "DISABLE_EXCEPTION_CATCHING=0" -s "EXCEPTION_DEBUG=1" -s "FORCE_FILESYSTEM=1" -s "MODULARIZE=1" -s "EXPORT_ES6=1" -s 'EXPORT_NAME="FastTextModule"' -Isrc/  src/dictionary.cc -o dictionary.bc
em++: warning: generating an executable with an object extension (.bc).  If you meant to build an object file please use `-c, `-r`, or `-shared` [-Wemcc]
em++ --bind --std=c++11 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun', 'FS']" -s "DISABLE_EXCEPTION_CATCHING=0" -s "EXCEPTION_DEBUG=1" -s "FORCE_FILESYSTEM=1" -s "MODULARIZE=1" -s "EXPORT_ES6=1" -s 'EXPORT_NAME="FastTextModule"' -Isrc/ src/loss.cc -o loss.bc
em++: warning: generating an executable with an object extension (.bc).  If you meant to build an object file please use `-c, `-r`, or `-shared` [-Wemcc]
em++ --bind --std=c++11 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun', 'FS']" -s "DISABLE_EXCEPTION_CATCHING=0" -s "EXCEPTION_DEBUG=1" -s "FORCE_FILESYSTEM=1" -s "MODULARIZE=1" -s "EXPORT_ES6=1" -s 'EXPORT_NAME="FastTextModule"' -Isrc/  src/productquantizer.cc -o productquantizer.bc
em++: warning: generating an executable with an object extension (.bc).  If you meant to build an object file please use `-c, `-r`, or `-shared` [-Wemcc]
em++ --bind --std=c++11 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun', 'FS']" -s "DISABLE_EXCEPTION_CATCHING=0" -s "EXCEPTION_DEBUG=1" -s "FORCE_FILESYSTEM=1" -s "MODULARIZE=1" -s "EXPORT_ES6=1" -s 'EXPORT_NAME="FastTextModule"' -Isrc/ src/densematrix.cc -o densematrix.bc
em++: warning: generating an executable with an object extension (.bc).  If you meant to build an object file please use `-c, `-r`, or `-shared` [-Wemcc]
em++ --bind --std=c++11 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun', 'FS']" -s "DISABLE_EXCEPTION_CATCHING=0" -s "EXCEPTION_DEBUG=1" -s "FORCE_FILESYSTEM=1" -s "MODULARIZE=1" -s "EXPORT_ES6=1" -s 'EXPORT_NAME="FastTextModule"' -Isrc/ src/quantmatrix.cc -o quantmatrix.bc
em++: warning: generating an executable with an object extension (.bc).  If you meant to build an object file please use `-c, `-r`, or `-shared` [-Wemcc]
em++ --bind --std=c++11 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun', 'FS']" -s "DISABLE_EXCEPTION_CATCHING=0" -s "EXCEPTION_DEBUG=1" -s "FORCE_FILESYSTEM=1" -s "MODULARIZE=1" -s "EXPORT_ES6=1" -s 'EXPORT_NAME="FastTextModule"' -Isrc/  src/vector.cc -o vector.bc
em++: warning: generating an executable with an object extension (.bc).  If you meant to build an object file please use `-c, `-r`, or `-shared` [-Wemcc]
em++ --bind --std=c++11 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun', 'FS']" -s "DISABLE_EXCEPTION_CATCHING=0" -s "EXCEPTION_DEBUG=1" -s "FORCE_FILESYSTEM=1" -s "MODULARIZE=1" -s "EXPORT_ES6=1" -s 'EXPORT_NAME="FastTextModule"' -Isrc/  src/model.cc -o model.bc
em++: warning: generating an executable with an object extension (.bc).  If you meant to build an object file please use `-c, `-r`, or `-shared` [-Wemcc]
em++ --bind --std=c++11 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun', 'FS']" -s "DISABLE_EXCEPTION_CATCHING=0" -s "EXCEPTION_DEBUG=1" -s "FORCE_FILESYSTEM=1" -s "MODULARIZE=1" -s "EXPORT_ES6=1" -s 'EXPORT_NAME="FastTextModule"' -Isrc/  src/utils.cc -o utils.bc
em++: warning: generating an executable with an object extension (.bc).  If you meant to build an object file please use `-c, `-r`, or `-shared` [-Wemcc]
em++ --bind --std=c++11 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun', 'FS']" -s "DISABLE_EXCEPTION_CATCHING=0" -s "EXCEPTION_DEBUG=1" -s "FORCE_FILESYSTEM=1" -s "MODULARIZE=1" -s "EXPORT_ES6=1" -s 'EXPORT_NAME="FastTextModule"' -Isrc/  src/meter.cc -o meter.bc
em++: warning: generating an executable with an object extension (.bc).  If you meant to build an object file please use `-c, `-r`, or `-shared` [-Wemcc]
em++ --bind --std=c++11 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun', 'FS']" -s "DISABLE_EXCEPTION_CATCHING=0" -s "EXCEPTION_DEBUG=1" -s "FORCE_FILESYSTEM=1" -s "MODULARIZE=1" -s "EXPORT_ES6=1" -s 'EXPORT_NAME="FastTextModule"' -Isrc/  src/fasttext.cc -o fasttext.bc
em++: warning: generating an executable with an object extension (.bc).  If you meant to build an object file please use `-c, `-r`, or `-shared` [-Wemcc]
em++ --bind --std=c++11 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun', 'FS']" -s "DISABLE_EXCEPTION_CATCHING=0" -s "EXCEPTION_DEBUG=1" -s "FORCE_FILESYSTEM=1" -s "MODULARIZE=1" -s "EXPORT_ES6=1" -s 'EXPORT_NAME="FastTextModule"' -Isrc/  webassembly/fasttext_wasm.cc -o main.bc
em++: warning: generating an executable with an object extension (.bc).  If you meant to build an object file please use `-c, `-r`, or `-shared` [-Wemcc]
error: undefined symbol: _ZN8fasttext11DenseMatrixC1Ev (referenced by top-level compiled C/C++ code)
warning: Link with `-s LLD_REPORT_UNDEFINED` to get more information on undefined symbols
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
warning: __ZN8fasttext11DenseMatrixC1Ev may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZN8fasttext4ArgsC1Ev (referenced by top-level compiled C/C++ code)
warning: __ZN8fasttext4ArgsC1Ev may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZN8fasttext6Vector4zeroEv (referenced by top-level compiled C/C++ code)
warning: __ZN8fasttext6Vector4zeroEv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZN8fasttext6VectorC1Ex (referenced by top-level compiled C/C++ code)
warning: __ZN8fasttext6VectorC1Ex may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZN8fasttext8FastText12getAnalogiesEiRKNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_S9_ (referenced by top-level compiled C/C++ code)
warning: __ZN8fasttext8FastText12getAnalogiesEiRKNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_S9_ may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZN8fasttext8FastText17getSentenceVectorERNSt3__213basic_istreamIcNS1_11char_traitsIcEEEERNS_6VectorE (referenced by top-level compiled C/C++ code)
warning: __ZN8fasttext8FastText17getSentenceVectorERNSt3__213basic_istreamIcNS1_11char_traitsIcEEEERNS_6VectorE may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZN8fasttext8FastText5getNNERKNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEi (referenced by top-level compiled C/C++ code)
warning: __ZN8fasttext8FastText5getNNERKNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEi may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZN8fasttext8FastText5trainERKNS_4ArgsERKNSt3__28functionIFvffddxEEE (referenced by top-level compiled C/C++ code)
warning: __ZN8fasttext8FastText5trainERKNS_4ArgsERKNSt3__28functionIFvffddxEEE may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZN8fasttext8FastText9loadModelERKNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE (referenced by top-level compiled C/C++ code)
warning: __ZN8fasttext8FastText9loadModelERKNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZN8fasttext8FastText9saveModelERKNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE (referenced by top-level compiled C/C++ code)
warning: __ZN8fasttext8FastText9saveModelERKNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZN8fasttext8FastTextC1Ev (referenced by top-level compiled C/C++ code)
warning: __ZN8fasttext8FastTextC1Ev may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext10Dictionary11getSubwordsERKNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERNS1_6vectorIiNS5_IiEEEERNSA_IS7_NS5_IS7_EEEE (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext10Dictionary11getSubwordsERKNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERNS1_6vectorIiNS5_IiEEEERNSA_IS7_NS5_IS7_EEEE may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext10Dictionary4hashERKNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext10Dictionary4hashERKNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext10Dictionary5getIdERKNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEj (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext10Dictionary5getIdERKNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEj may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext10Dictionary7getTypeERKNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext10Dictionary7getTypeERKNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext10Dictionary7getTypeEi (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext10Dictionary7getTypeEi may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext10Dictionary7getWordEi (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext10Dictionary7getWordEi may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext10Dictionary8getLabelEi (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext10Dictionary8getLabelEi may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext10Dictionary8readWordERNSt3__213basic_istreamIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext10Dictionary8readWordERNSt3__213basic_istreamIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext10Dictionary9getCountsENS_10entry_typeE (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext10Dictionary9getCountsENS_10entry_typeE may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext5Meter6recallEv (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext5Meter6recallEv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext5Meter7f1ScoreEv (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext5Meter7f1ScoreEv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext5Meter9precisionEv (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext5Meter9precisionEv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext8FastText11predictLineERNSt3__213basic_istreamIcNS1_11char_traitsIcEEEERNS1_6vectorINS1_4pairIfNS1_12basic_stringIcS4_NS1_9allocatorIcEEEEEENSA_ISD_EEEEif (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext8FastText11predictLineERNSt3__213basic_istreamIcNS1_11char_traitsIcEEEERNS1_6vectorINS1_4pairIfNS1_12basic_stringIcS4_NS1_9allocatorIcEEEEEENSA_ISD_EEEEif may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext8FastText12getDimensionEv (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext8FastText12getDimensionEv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext8FastText12getSubwordIdERKNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext8FastText12getSubwordIdERKNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext8FastText13getDictionaryEv (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext8FastText13getDictionaryEv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext8FastText13getWordVectorERNS_6VectorERKNSt3__212basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext8FastText13getWordVectorERNS_6VectorERKNSt3__212basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext8FastText14addInputVectorERNS_6VectorEi (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext8FastText14addInputVectorERNS_6VectorEi may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext8FastText14getInputMatrixEv (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext8FastText14getInputMatrixEv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext8FastText15getOutputMatrixEv (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext8FastText15getOutputMatrixEv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext8FastText4testERNSt3__213basic_istreamIcNS1_11char_traitsIcEEEEifRNS_5MeterE (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext8FastText4testERNSt3__213basic_istreamIcNS1_11char_traitsIcEEEEifRNS_5MeterE may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext8FastText7getArgsEv (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext8FastText7getArgsEv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext8FastText7isQuantEv (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext8FastText7isQuantEv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZNK8fasttext8FastText9getWordIdERKNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE (referenced by top-level compiled C/C++ code)
warning: __ZNK8fasttext8FastText9getWordIdERKNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
Error: Aborting compilation due to previous errors
em++: error: '/emsdk/node/12.18.1_64bit/bin/node /emsdk/upstream/emscripten/src/compiler.js /tmp/tmp78z6n_eu.txt' failed (1)
make: *** [Makefile:81: main.bc] Error 1

Is there a docker image or something that guarantees that master can build?

@Celebio Celebio added Build build issue wasm labels Dec 18, 2020
@vaaaaanquish
Copy link
Author

emsdk version seems to be the cause.

In the docker container, I ran the following. So it worked.

$ git clone https://github.com/emscripten-core/emsdk.git
$ cd emsdk
$ ./emsdk install 1.39.12
$ ./emsdk activate 1.39.12
$ source "/src/emsdk/emsdk_env.sh"

$  em++ --version
cache:INFO: generating system asset: is_vanilla.txt... (this will be cached in "/src/emsdk/upstream/emscripten/cache/is_vanilla.txt" for subsequent builds)
cache:INFO:  - ok
emcc (Emscripten gcc/clang-like replacement) 1.39.12
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ git clone https://github.com/facebookresearch/fastText.git
$ cd fastText
$ make wasm
...
$ ls webassembly/
README.md  doc	fasttext.js  fasttext_wasm.cc  fasttext_wasm.js  fasttext_wasm.wasm

I'm trying to figure out which specific feature updates are causing the problem...

@vaaaaanquish
Copy link
Author

We explored. Does not work emsdk>=2.0.4

  • emsdk=="2.0.3" : success
  • emsdk=="2.0.4" : faild

@vaaaaanquish
Copy link
Author

It looks like the following.

  • Stop including malloc and free by default. If you need access to them from
    JS, you must export them manually using
    -s EXPORTED_FUNCTIONS=['_malloc', ..].

emsdk release note: https://emscripten.org/docs/introducing_emscripten/release_notes.html
emsdk's Q&A: https://emscripten.org/docs/getting_started/FAQ.html#why-do-functions-in-my-c-c-source-code-vanish-when-i-compile-to-javascript-and-or-i-get-no-functions-to-process

@loretoparisi
Copy link

We explored. Does not work emsdk>=2.0.4

  • emsdk=="2.0.3" : success
  • emsdk=="2.0.4" : faild

I confirm that doing

./emsdk install 2.0.3
cd ..
cd fastText
make clean
make wasm

it works!

...
em++: warning: assuming object file output, based on output filename alone.  Add an explict `-c`, `-r` or `-shared` to avoid this warning [-Wemcc]
em++ --bind --std=c++11 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun', 'FS']" -s "DISABLE_EXCEPTION_CATCHING=0" -s "EXCEPTION_DEBUG=1" -s "FORCE_FILESYSTEM=1" -s "MODULARIZE=1" -s "EXPORT_ES6=1" -s 'EXPORT_NAME="FastTextModule"' -Isrc/  webassembly/fasttext_wasm.cc -o main.bc
em++: warning: assuming object file output, based on output filename alone.  Add an explict `-c`, `-r` or `-shared` to avoid this warning [-Wemcc]
em++ --bind --std=c++11 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun', 'FS']" -s "DISABLE_EXCEPTION_CATCHING=0" -s "EXCEPTION_DEBUG=1" -s "FORCE_FILESYSTEM=1" -s "MODULARIZE=1" -s "EXPORT_ES6=1" -s 'EXPORT_NAME="FastTextModule"' -Isrc/ args.bc autotune.bc matrix.bc dictionary.bc loss.bc productquantizer.bc densematrix.bc quantmatrix.bc vector.bc model.bc utils.bc meter.bc fasttext.bc main.bc -o webassembly/fasttext_wasm.js
mbploreto:fastText loretoparisi$ cd webassembly/
mbploreto:webassembly loretoparisi$ ls
README.md		doc			fasttext.js		fasttext_wasm.cc	fasttext_wasm.js	fasttext_wasm.wasm

@searleser97
Copy link

searleser97 commented Sep 29, 2021

Does anyone know What would be the modification to the Makefile in order to be able to use the latest version of emscripten ?

@vaaaaanquish
Copy link
Author

Perhaps, it need to add an -s EXPORTED_FUNCTION Makefile
https://github.com/facebookresearch/fastText/blob/master/Makefile#L76

@vaaaaanquish vaaaaanquish linked a pull request Sep 30, 2021 that will close this issue
@vaaaaanquish
Copy link
Author

@searleser97 @loretoparisi @Celebio Thx for response. #1227 solved the problem.

@loretoparisi
Copy link

@vaaaaanquish welcome, btw I put the pre-built WASM here in FastText.js

@vaaaaanquish
Copy link
Author

@loretoparisi Great works!
It would be nice to have a link in the documentation

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Build build issue wasm
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants