Skip to content

_free is not defined runtime error #19267

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

Closed
jeswr opened this issue May 1, 2023 · 2 comments
Closed

_free is not defined runtime error #19267

jeswr opened this issue May 1, 2023 · 2 comments

Comments

@jeswr
Copy link
Contributor

jeswr commented May 1, 2023

Upgrading from emsdk 3.1.36 to 3.1.37 we have observed that we now get a _free is undefined error at runtime in particular environments, in particular trying to execute this line of code when no .data file is provided and instead we are generating a dl image in advance that gets loaded (for example see this sample project).

I suspect the removal of the global _free function for these environments occurred in this commit.

Is this an intentional breaking change? If so is there an easy fix on our end?

cc @rla @JanWielemaker

@sbc100
Copy link
Collaborator

sbc100 commented May 1, 2023

I agree that the likely candidate is #18905.

If you want to use _malloc or _free outside of emscripten then you need to explicitly export them by adding them to EXPORTED_FUNCTIONS. e.g. -sEXPORTED_FUNCTIONS=_malloc,_free. This has been the case for a while now but I think perhaps the old reverse deps system was hiding the issue.

@jeswr
Copy link
Contributor Author

jeswr commented May 1, 2023

Thanks for the info and quick response! Adding those to the list of exported functions indeed solved our issue.

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

2 participants