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

I can't get EXPORT_ALL=1 to work anymore #23481

Open
angros47 opened this issue Jan 23, 2025 · 4 comments
Open

I can't get EXPORT_ALL=1 to work anymore #23481

angros47 opened this issue Jan 23, 2025 · 4 comments

Comments

@angros47
Copy link

Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 4.0.1 (89ce854)
clang version 20.0.0git (https:/github.com/llvm/llvm-project a32e36faf84bd7da3df0c7d50bb9020568128417)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /home/angelo/Documenti/FreeBASIC/emsdk/upstream/bin

I was trying to compile my project OpenB3D (https://github.com/angros47/OpenB3D ), using "make web" to create the file OpenB3D.o, and then I tried to compile it to a library usable directly from JavaScript. The command I used is:

emcc OpenB3D.o -o OpenB3D.html -s EXPORT_ALL=1 -s ALLOW_MEMORY_GROWTH=1 -s LINKABLE=1 -s EXPORTED_RUNTIME_METHODS=ccall,cwrap

I was supposed to obtain a 2Mb file OpenB3D.wasm, and a file OpenB3D.js (last time I did it was in May 2024.
Instead, I obtained only a 200 kb OpenB3D.wasm file, that seems to have eliminated most code. Since the functions I want to export are more than 300, and since the code needs to be compiled also with GCC as native code, modifying it to add the EMSCRIPTEN_KEEPALIVE macro for each function is not an option.

I don't know if it's related with the issues, but since the last time it worked I have updated my OS from Ubuntu 22 to Ubuntu 24.

@sbc100
Copy link
Collaborator

sbc100 commented Jan 23, 2025

Thanks for bug report, that does sounds like a regression. Do you happen to remember the last version of emscripten where this did work for you?

BTW, if you do want avoid exporting more stuff that you need to (for example I'm sure you don't need to export all the libc symbols that you use right?) you could try -sEXPORTED_FUNCTIONS=@exports.txt, and maintain exports.txt as a list of symbols, one per line, that you want to export. We should still fix the regression but in case you can enumerate the symbols you need that might be a better place to end up.

@angros47
Copy link
Author

Unfortunately I don't remember the last working version. The last version of the library that I have compiled successfully was made in May 2024. After that, I don't remember if I updated Emscripten or not (but I updated the OS in August 2024). Two days ago I tried to recompile the library, and the issue happened, so I updated Emscripten to the last version, and it failed.

I already linked the source code of the library, the latest working compiled version of the library is here:
https://github.com/angros47/OpenB3D-JS

(maybe from the OpenB3D.js file is possible to see the version of the compiler?)

The instructions to rebuild it are:
make web
emcc OpenB3D.o -o OpenB3D.html -s EXPORT_ALL=1 -s ALLOW_MEMORY_GROWTH=1 -s LINKABLE=1 -s EXPORTED_RUNTIME_METHODS=ccall,cwrap

It was supposed to produce the files OpenB3D.html (useless), OpenB3D.js and OpenB3D.wasm (included in the repository): those two files, along with OpenB3DJS.js, allowed to use the commands of OpenB3D from JavaScript.

I have tried for three days, with no success, to do that again, and now I am completely lost.

@sbc100
Copy link
Collaborator

sbc100 commented Jan 23, 2025

Looking at the release dates for emscripten releases it looks like if you were building in May 2024 you would have been using 3.1.59, 3.1.60 (assuming you were using the current version back then.

@angros47
Copy link
Author

I think I was, I would have likely updated to the last version before building the version I published

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