Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to recompile vmsg.wasm? #64

Open
lucivpav opened this issue Apr 28, 2021 · 2 comments
Open

How to recompile vmsg.wasm? #64

lucivpav opened this issue Apr 28, 2021 · 2 comments

Comments

@lucivpav
Copy link

I have downloaded Emscripten SDK, downloaded the latest and activated it.

Not sure what

fix LLVM_ROOT variable of Emscripten config

means.

When make clean all finishes successfully, the generated vmsg.wasm contains the following imports:

Import[2]:
 - func[0] sig=10 <a.a> <- a.a // aka env.exit
 - func[1] sig=1 <a.b> <- a.b // aka env.emscripten_resize_heap

which is not compatible with the imports specified in vmsg.js:

{
         memory: memory,
         pow: Math.pow,
         exit: exit,
         powf: Math.pow,
         exp: Math.exp,
         sqrtf: Math.sqrt,
         cos: Math.cos,
         log: Math.log,
         sin: Math.sin,
         sbrk: sbrk,
};

As a result, trying to run a project with the recompiled vmsg.wasm throws an error TypeError: WebAssembly.instantiate(): Import #0 module="a" error: module is not an object or function
I am guessing that the vmsg.js should be also regenerated using the Emscripten SDK. However, simply using the _vmsg.js in place of vmsg.js does not work - it causes other issues. It seems that vmsg.js has vmsg specific logic, that is not generated in _vmsg.js.

I tried to update the env object in vmsg.js to match the needs of the generated _vmsg.wasm, that is, to:

{
      "exit": _exit,
      "emscripten_resize_heap": _emscripten_resize_heap,
}

However, the implementation of _emscripten_resize_heap is dependent on a lot of generated logic/variables, that I find very hard to take and include in the original vmsg.js file.

Any advice on how to proceed with building this project?

@s1239u85
Copy link

Exact same issue here.

@NegiBaba
Copy link

NegiBaba commented Sep 1, 2023

I have tried recompiling the vmsg.wasm as well by following all the steps as said in the readme. So the we require the LLVM_ROOT when we are manually building from source, for anyone who's new to it can check emscripten_configuration link. Anyone can easily configure the LLVM_ROOT var. there.
Now for the next issue if we try to

make clean all

the first issue we get is something related emscripten_memcpy_big and we get the help in the console it self.
We receive two ways we can move forward one is to force ignore the errors and second one is to include this in EXPORTED_FUNCTIONS but both of these ways gives us error when trying to record in the local dev server(the same issue as above that module is not an object)
I have tried several things as well but writing those here doesn't make any sense. So until and unless someone who's expert in web assembly looks at this issue, we are most probably going to resolve this by ourselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants