You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I recently started an Emscripten/WebGL C++ project, but I'm having difficulties integrating Flecs. I'm not quite sure where to ask for help for this, but I figured I'd give it a shot here first.
Describe the bug
If I try to add some basic Flecs code to my C++ project, then when I build and run it I get the following error output:
[WARN] [Emscripten]: error: api.c: 258: member 'flecs.meta.Vector.type' has an invalid error range [2447656..0] line 241 > inlineScript:39:62
[WARN] [Emscripten]: fatal: entity.c: 2040: flecs.meta.Vector (CONSTRAINT_VIOLATED) line 241 > inlineScript:39:62
[WARN] [Emscripten]: Aborted(native code called abort()) line 241 > inlineScript:39:62
Uncaught RuntimeError: Aborted(native code called abort())
abort http://localhost:8000/js/webtemplate.js line 241 > srcScript:875
_abort http://localhost:8000/js/webtemplate.js line 241 > srcScript:5538
invoke_ii http://localhost:8000/js/webtemplate.js line 241 > srcScript:12503
webtemplate http://localhost:8000/js/webtemplate.js line 241 > srcScript:906
callMain http://localhost:8000/js/webtemplate.js line 241 > srcScript:13133
doRun http://localhost:8000/js/webtemplate.js line 241 > srcScript:13184
run http://localhost:8000/js/webtemplate.js line 241 > srcScript:13195
quit_ http://localhost:8000/js/webtemplate.js:241
handleException http://localhost:8000/js/webtemplate.js:9178
callMain http://localhost:8000/js/webtemplate.js:13127
doRun http://localhost:8000/js/webtemplate.js:13171
run http://localhost:8000/js/webtemplate.js:13182
setTimeout handler*run http://localhost:8000/js/webtemplate.js:13178
runCaller http://localhost:8000/js/webtemplate.js:13098
removeRunDependency http://localhost:8000/js/webtemplate.js:842
receiveInstance http://localhost:8000/js/webtemplate.js:1057
receiveInstantiationResult http://localhost:8000/js/webtemplate.js:1075
promise callback*webtemplate/instantiateAsync/webtemplate< http://localhost:8000/js/webtemplate.js:1010
promise callback*instantiateAsync http://localhost:8000/js/webtemplate.js:1002
createWasm http://localhost:8000/js/webtemplate.js:1096
webtemplate http://localhost:8000/js/webtemplate.js:12390
<anonymous> http://localhost:8000/:61
webtemplate.js line 241 > srcScript:875:11
abort http://localhost:8000/js/webtemplate.js line 241 > srcScript:875
_abort http://localhost:8000/js/webtemplate.js line 241 > srcScript:5538
abort http://localhost:8000/js/webtemplate.wasm:0
flecs_throw_invalid_delete http://localhost:8000/js/webtemplate.wasm:814003
flecs_on_delete_mark http://localhost:8000/js/webtemplate.wasm:799054
flecs_on_delete http://localhost:8000/js/webtemplate.wasm:785747
ecs_delete http://localhost:8000/js/webtemplate.wasm:782017
ecs_struct_init http://localhost:8000/js/webtemplate.wasm:677963
FlecsMetaImport http://localhost:8000/js/webtemplate.wasm:689521
ecs_import http://localhost:8000/js/webtemplate.wasm:708128
ecs_import_c http://localhost:8000/js/webtemplate.wasm:708359
ecs_init http://localhost:8000/js/webtemplate.wasm:1239127
AppContext::AppContext() http://localhost:8000/js/webtemplate.wasm:72277
invoke_ii http://localhost:8000/js/webtemplate.js line 241 > srcScript:12503
main http://localhost:8000/js/webtemplate.wasm:71735
webtemplate http://localhost:8000/js/webtemplate.js line 241 > srcScript:906
callMain http://localhost:8000/js/webtemplate.js line 241 > srcScript:13133
doRun http://localhost:8000/js/webtemplate.js line 241 > srcScript:13184
run http://localhost:8000/js/webtemplate.js line 241 > srcScript:13195
enter resource://devtools/server/actors/utils/event-loop.js:82
_onExceptionUnwind resource://devtools/server/actors/thread.js:2020
quit_ http://localhost:8000/js/webtemplate.js:241
handleException http://localhost:8000/js/webtemplate.js:9178
callMain http://localhost:8000/js/webtemplate.js:13127
doRun http://localhost:8000/js/webtemplate.js:13171
run http://localhost:8000/js/webtemplate.js:13182
(Async: setTimeout handler)
run http://localhost:8000/js/webtemplate.js:13178
runCaller http://localhost:8000/js/webtemplate.js:13098
removeRunDependency http://localhost:8000/js/webtemplate.js:842
receiveInstance http://localhost:8000/js/webtemplate.js:1057
receiveInstantiationResult http://localhost:8000/js/webtemplate.js:1075
(Async: promise callback)
webtemplate http://localhost:8000/js/webtemplate.js:1010
(Async: promise callback)
instantiateAsync http://localhost:8000/js/webtemplate.js:1002
createWasm http://localhost:8000/js/webtemplate.js:1096
webtemplate http://localhost:8000/js/webtemplate.js:12390
<anonymous> http://localhost:8000/:61
To Reproduce
Not quite sure...
Expected behavior
Seeing [ECS test]: Bob lives! in the logger.
Additional context
System info:
Operating System: Arch Linux
Kernel: Linux 6.4.12-arch1-1
Architecture: x86-64
Hardware Vendor: Lenovo
Hardware Model: Lenovo ideapad Y700-15ISK
The App instance gets constructed before the Emscripten main-loop (since it's responsible for most initialization and such), but this shouldn't be an issue for Flecs, should it?
Some possibly relevant parts of the CMakeLists.txt:
Try adding -s STACK_SIZE=1mb to your link flags. I'm not sure what the minimum required is, it seems the emscripten default was previously higher, but now is only 64k.
Discovered this because using the flecs C API in emscripten builds gives this error after ecs_init: Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 65536)
Hi, I recently started an Emscripten/WebGL C++ project, but I'm having difficulties integrating Flecs. I'm not quite sure where to ask for help for this, but I figured I'd give it a shot here first.
Describe the bug
If I try to add some basic Flecs code to my C++ project, then when I build and run it I get the following error output:
To Reproduce
Not quite sure...
Expected behavior
Seeing
[ECS test]: Bob lives!
in the logger.Additional context
System info:
em++ --version:
In the C++ code, all the Flecs code is the following:
And if I comment these Flecs parts out of the code above, then the application runs as intended (sans any Flecs, of course).
main.cpp
has the following:The App instance gets constructed before the Emscripten main-loop (since it's responsible for most initialization and such), but this shouldn't be an issue for Flecs, should it?
Some possibly relevant parts of the
CMakeLists.txt
:And some possibly relevant parts of the
index.html
:Do I need to do something particular with moduleArgs or something?
Thanks in advance for any help!
I really hope that I can get this working, Flecs seems absolutely amazing. ❤️
edit:
When I build the project as a binary without Emscripten, I get the expected output:
The text was updated successfully, but these errors were encountered: