-
Notifications
You must be signed in to change notification settings - Fork 3.4k
How to include Module._malloc and Module._free with the latest update? #12644
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
Comments
For example can you run Oh.. I see this is a runtime error which means as far as the compiler is concerned the functions do exist... but they are somehow not found in the wasm module at runtime.. could the wasm module being loaded be out-of-date? Can you see using |
Ok I just got the idea to clear the cache (emcc --clear-cache) and I recompiled everything, with -s EXPORTED_FUNCTIONS="['_main', '_malloc', '_free']", and it works! I don't know what happened, I am pretty sure my previous wasm module was the most recent one. Anyway, always good to clear the cache :) |
Actaully .. the cache should always be cleared when you update between emscripten versions so what you describe should not be possible. Just FYI in case this comes up again it might be a sign of a different issue with stale cache. |
When I clear the cache, emscripten generates a few files (liba...), but don't use to happen when I update to a new emscripten versions... Anyway, better to clear the clear twice to be sure ;) (I am using emscripten on linux) |
When you install new emsdk versions that cache is completely erased and replaced with a new set of pre-built libraries that ship with the emsdk (so that users don't all need to build libc the first time they do anything). (BTW are you using the normal cache location of emsdk/upstream/emscripten/cache?) |
Hello guys,
I just upgraded to the latest version of emscripten and I can't make my project to work anymore. I didn't do any change, I just needed to recompile. 2 months ago it worked fine.
It looks like the new version doesn't include Module._malloc et Module._free anymore >Stop including malloc/free by default #12213
So now I got the error : Module._malloc is not a function
And by comparing with my old working compiled project, I can see that these lines are missing in the generated JS :
Object.getOwnPropertyDescriptor(a.ready,"_malloc") ...
Object.getOwnPropertyDescriptor(a.ready,"_free") ...
I tried to add the malloc and free manually : emcc .... -s EXPORTED_FUNCTIONS="['_malloc', '_free']"
But now I get this error : RuntimeError: abort(Assertion failed: exported native function malloc not found)
How to include Module._malloc and Module._free with the latest emscripten update?
Thanks for your help, I lost 3 hours on this :/
The text was updated successfully, but these errors were encountered: