Hi, everyone,
First of all, congratulations on the amazing job of developing a tool like Emscripten.
In order to learn wasm in practice, I've started to compile other people's libraries and, when I find any roadblock, google my way around it.
I'm asking for your help because in this case, I don't know what else to do.
The moment I face an issue is when I ask Emscripten to generate the JS code to let me run the WASM code.
These are the steps I followed.
1. First of all, I checked I could compile the repository using C++, by running make. And it worked.
2. Then I run:
# emmake make repaq CXX=emcc CXXFLAGS="-s USE_ZLIB=1 -s RELOCATABLE=1 -s USE_PTHREADS=0 $CXXFLAGS"
Emscripten also works and, despite some warnings, I get a valid repaq.wasm file.
3. I rename repaq.wasm to repaq.o for the next step.
# mv repaq.wasm repaq.o
4. Now I run:
# emcc -v repaq.o -o repaq.js -s USE_ZLIB=1 -s RELOCATABLE=1 -s USE_PTHREADS=0 -s EXTRA_EXPORTED_RUNTIME_METHODS="['callMain']" -Wl,--relocatable
and it fails with:
wasm-ld: error: repaq.o: not a relocatable wasm file
The files were clearly generated with "-s RELOCATABLE=1" and I don't find documentation on what else to do about it.
Any ideas?
Thank you for your kind attention,
Fernando
These are the versions of the tools I'm using:
# emcc --version
emcc (Emscripten gcc/clang-like replacement) 1.39.17 (e4271595539cf1ca81128280cdc72f7245e700a0)
# emcc -Wl,--version
LLD 11.0.0 (/b/s/w/ir/cache/git/chromium.googlesource.com-external-github.com-llvm-llvm--project cc2349e3cf0e1f492433941b359a03fc3f746410)
Note: I already tried combining lots of options, as well as removing "-lpthreads" from the make file, but I always get stuck here.
If I use "-s USE_PTHREADS=1" I get a different type of error, related to atomics.
However as the original project still compiles in C++ and works even without "-lpthreads", I preferred to test it this way in order to simplify.