Closed BinBashBanana closed 3 years ago
I had to rename it, because otherwise it would conflict with a variable in libretro_emscripten.bc when I tried to link the final file.
No, you cannot rename it. Instead you should define HAVE_STRTOF_L.
I barely even know C, so I wouldn't know how to do that. What is the branch that supports emscripten?
It's not a C thing, it's just changing this line:
DEFINES += -std=gnu99 -DHAVE_LOCALE
to this:
DEFINES += -std=gnu99 -DHAVE_LOCALE -DHAVE_STRTOF_L
The branch is here fwiw: https://github.com/endrift/mgba/tree/feature/wasm
Does that go in the makefile in mGBA or in RetroArch?
Makefile.libretro line 390, you added a line right after it.
I reverted formatting.c and formatting.h, added -DHAVE_STRTOF_L to Makefile.libretro, tried recompiling but got this error:
src/util/formatting.c:67:14: error: implicit declaration of function 'strtof_l' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
float res = strtof_l(str, end, l);
^
src/util/formatting.c:67:14: note: did you mean 'strtof_u'?
src/util/formatting.c:61:7: note: 'strtof_u' declared here
float strtof_u(const char* restrict str, char** restrict end) {
^
1 error generated.
You should try also adding -DHAVE_XLOCALE
It throws the same error.
Try -D_GNU_SOURCE
instead of -DHAVE_XLOCALE
Looks good now, thanks
You beat me to it. :)
This change allows mGBA to be built for emscripten