wasm/emscripten compilation error
When trying to compile miniaudio with emscripten, I get the following error
miniaudio/miniaudio.h:61864:12: error: use of undeclared identifier 'strcasecmp'
does this ring a bell to anyone by any chance ?
I don't understand why it's not working. I see <strings.h> is included alright 🤔
Thank you.
This is strange. I just tried the dev branch just now and it's compiling just fine for me. I don't have an explanation for this one. Have you tried compiling the simple_playback_sine example?
Thank you for confirming it works for you. Let me check this example. ☝️
I might have to tweak by compilation settings...
Did you ever figure this one out? Just checking if I can close this ticket.
not yet, sorry, but I will figure it out this week and post an update here.
I don't have time to work on wasm right now, I'm closing this and will reopen if needed when I'm back on wasm stuff. Thanks.
Update :
I tried compiling simple_playback_sine example like you suggested and I had no issue.
But I still cannot compile my own code due to the use of strcasecmp.
I am wondering if it's because the example doesn't use the miniaudio functions that are using strcasecmp and they are stripped somehow 🤔
If that's fine with you, I'll open a PR in with I replace strcasecmp by a to_lower + strcmp combination. :)
Oh, I know how those functions are "stripped".
It the use of
#define MA_NO_DECODING
#define MA_NO_ENCODING
in the simple_playback_sine example.
This is a problem with your build environment. I'm not replicating this, even when commenting out those two lines, and you're the only one whose reporting this problem. I don't have an explanation on what specifically is causing it.
What version of emcc are you using, and what flags are you using with emcc? This is mine:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.24 (68a9f990429e0bcfb63b1cde68bad792554350a5)
clang version 16.0.0 (https://github.com/llvm/llvm-project 277c382760bf9575cfa2eac73d5ad1db91466d3f)
Target: wasm32-unknown-emscripten
Thread model: posix
And I just compile like this:
emcc ../simple_playback_sine.c -o bin/simple_playback_sine.html
Oh, you are right! I can compile miniaudio alright in other contexts than my project. 😐 Sorry for wasting your time... and thanks a lot for your help.
I am using cmake (and emcmake), with an included CMakeList file compiling the Miniaudio implementation...
I am still debugging this issue as I don't know the reason for it yet.
I'll keep debugging this on my end. Thanks again!