Open patrickinminneapolis opened 1 year ago
This may require investigating how the build system built mecab.bc
. First thing I would do, though, is see what that file actually is. file src/.libs/mecab.bc
on linux at least can help there, printing something like
$ file libb.a
libb.a: current ar archive
$ file b.o
b.o: WebAssembly (wasm) binary module version 0x1 (MVP)
file mecab.bc mecab.bc: ASCII text, with very long lines (65536), with no line terminators
If you open up mecab.bc
what do you see? If it was really a bitcode file then most likely the file
command should say so:
$ emcc -c test.c -flto -o out.bc
$ file out.bc
out.bc: LLVM IR bitcode
emcc -v emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.45 (ef3e4e3b044de98e1811546e0bc605c65d3412f4) clang version 18.0.0 (https://github.com/llvm/llvm-project d1e685df45dc5944b43d2547d0138cd4a3ee4efe) Target: wasm32-unknown-emscripten Thread model: posix InstalledDir: /mnt/c/Users/16515/Desktop/prj/emsdk/emsdk/upstream/bin
I'm inside WSL2 Ubuntu 22.04 following this tutorial https://github.com/Birch-san/mecab/tree/master/mecab-web
em++ \ src/.libs/mecab.bc \ src/.libs/libmecab.so \ -o ../mecab-web/mecab.html \ -s EXPORTED_FUNCTIONS="[ '_mecab_do2', '_mecab_model_new2', '_mecab_model_destroy', '_mecab_strerror', '_mecab_model_new_tagger', '_mecab_destroy', '_mecab_nbest_sparse_tostr', '_mecab_sparse_tostr' ]" \ -s MODULARIZE=1 \ -s EXPORT_ES6=1 \ -s EXTRA_EXPORTED_RUNTIME_METHODS='[ "cwrap", "addOnExit", "FS" ]' \ --no-heap-copy \ -s ALLOW_MEMORY_GROWTH=1 \ --preload-file ../mecab-naist-jdic/dist@naist-jdic/
Gives "wasm-ld: error: unknown file type: src/.libs/mecab.bc"