-
Notifications
You must be signed in to change notification settings - Fork 39
Emscripten: error: conflicting types for 'emscripten_set_main_loop' #128
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
Recently testing the emscripten functionality I ran into this same issue. There was a commit to the emsdk which changed the definition. I think the sdl2 or some part of nico needs to update their end? Either way just to get this working I changed the def in emsdk back to its original int and everything worked. the relevant line is emscripten.h:41:6 Line 41 of the file change bool to int and voila! Upon further review I am deducing that the change from int/bool, though innocuous seeming, caused the issue as nim lacks a ctype for bool. To address the issue without the hacky revert of the emsdk change requires adding the ctype to nim and updating the typedef to include the new type. nim/lib/system/ctypes.nim, add above cint def: nico/backend/sdl2.nim, change def of set_main_loop: Then
|
Another update, I forked nimlang and nico repo to include the relevant changes. I am very new to contributing and apologize if I am not going about this correctly. |
@maxpicklez thanks for your help! If you need any help sending your PRs, feel free to ping me. However, it should be fairly straightforward using the GitHub interface. |
The issue requires adding a ctype to nim otherwise this change will likely break or at the least not resolve the issue. I personally feel like the emsdk should revert the change to bool but alas there is probably more to it than just that. Either way I will generate the pull request after I try and discuss the issue with the nimlang folks and/or emsdk. Thanks for the quick reply. |
Note that Nim itself uses _Bool in C99 mode: https://github.com/nim-lang/Nim/blob/devel/lib/nimbase.h#L318-L326 |
Im looking into this a bit, i see the pragma for the definition of _Bool. Im not sure where this pragma falls specifically for me so ill add a trace to see. The function signature, which is causing issues, uses cint and cchar and such, which are defined in ctypes.nim. Im trying to to see how the bool definition for nim itself applies, or if it does in this case. The function signature is located in nico/backends/sdl2.nim line 1834, on devel, proc emscripten_set_main_loop So perhaps not specific to the language itself but maybe the foreign function interface for C. Anyway I may be a bit out of my depth... |
FWIW I incorporated the change needed initially in nim/sysytem/ctypes.nim inline with the problematic code for me. This resolves the issue and keeps it away from the larger moving parts. I am not sure exactly if this works, which is why I am looking into writing a test assuming this is an integration test with emscripten and something to do with linking. Unclear if its statically or dynamically linked but I am assuming static as Im under the impression WASM dynlib support isn't fully stable. |
I created a pull request but to be honest Ive NEVER done this before so please let me know if I did something wrong. Will spend some time looking into integration tests/tests for this so feel free to reject/delete the pull request. |
Trying to build a minimal example for web but getting this error:
The text was updated successfully, but these errors were encountered: