-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Post Link for libraries #24250
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
we compile box2d and our glue code to bare wasm like so (this is the slow part, and bare wasm means we only have to do it once): emcc -lembind \
./csrc/glue.cpp \
./csrc/threading.cpp \
./csrc/debugDraw.cpp \
./enkiTS/src/TaskScheduler.cpp \
./cmake-build-deluxe/src/libbox2dd.a \
-I ./box2d/include \
-I ./enkiTS/src \
-I ./box2cpp/include \
-std=c++20 \
-s MODULARIZE=1 \
-s EXPORT_NAME=Box2D \
-s ALLOW_TABLE_GROWTH=1 \
-s FILESYSTEM=0 \
-s EXPORTED_FUNCTIONS=_malloc,_free \
-s ALLOW_MEMORY_GROWTH=1 \
-msimd128 -msse2 -pthread \
-s USE_PTHREADS=1 \
-s PTHREAD_POOL_SIZE=pthreadCount \
-g3 -gsource-map \
-s ASSERTIONS=2 \
--oformat=bare \
-o ./build/Box2D.deluxe.bare.wasm we then post-link emcc \
-g3 -gsource-map -pthread \
-s USE_PTHREADS=1 \
-s PTHREAD_POOL_SIZE='_emscripten_num_logical_cores()' \
-lembind \
-s ALLOW_MEMORY_GROWTH=1 \
--post-link ./build/Box2D.deluxe.bare.wasm \
-s EXPORT_ES6=1 \
-o ./build/dist/es/deluxe/Box2D.deluxe.mjs \
--emit-tsd ./build/dist/es/deluxe/Box2D.deluxe.d.ts this used to work in 3.1.73, but now fails (e.g. in 4.0.8), as Erik demonstrated above. |
you can reproduce in VSCode debugger via: {
"configurations": [
{
"name": "emcc",
"type": "debugpy",
"request": "launch",
"program": "emcc.py",
"args": [
"-g3", "-gsource-map", "-pthread",
"-s", "USE_PTHREADS=1",
"-s", "PTHREAD_POOL_SIZE='_emscripten_num_logical_cores()'",
"-lembind",
"-s", "ALLOW_MEMORY_GROWTH=1",
"--post-link", "/Users/birch/git/box2d3-wasm/box2d3-wasm/build/Box2D.deluxe.bare.wasm",
"-s", "EXPORT_ES6=1",
"-o", "/Users/birch/git/box2d3-wasm/box2d3-wasm/build/dist/es/deluxe/Box2D.deluxe.mjs",
"--emit-tsd",
"/Users/birch/git/box2d3-wasm/box2d3-wasm/build/dist/es/deluxe/Box2D.deluxe.d.ts",
],
"console": "integratedTerminal"
}
]
} it fails during parsing so you don't even need the files on your computer in order to repro |
Wow, that looks very wrong. One temporary workaround might be to merge your Also you can drop Also, for boolean options like |
We use
--post-link
in our build script to do the heavy lifting of compiling Box2D and our glue only once into a bare WASM and then do the cheap part creating a JS library multiple times (ESM / CommonJS).However a release after 3.1.73 broke
--post-link
for us. The use-case for libraries might not have been considered with the changes. We now trigger the following error:This is the command we use to build:
https://github.com/Birch-san/box2d3-wasm/blob/0a839337b041e1de851fc7be9e9a6aae6e4edc4e/box2d3-wasm/shell/1_build_wasm.sh#L143
Any suggestions for us on how to work around the issue, or do you see a way our use case could be considered?
The text was updated successfully, but these errors were encountered: