Compiling BitCode to WASM HTML5

I’m getting an error when trying to compile FMOD Studio BitCode to WASM

  • Using latest 2.02.20 HTML5 Package
  • Using files from api\studio\lib\fastcomp\bitcode
  • Running the command referenced in the documents

emcc -v

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.52 (fa478400df3351f7153c0279bc638784d3d90334)
clang version 18.0.0git (https://github.com/llvm/llvm-project 0a3a0ea5914cb4633f4f4c14f1ddc46ce067061a)
Target: wasm32-unknown-emscripten
Thread model: posix

Error Message

emcc --bind -Os -s EXPORT_NAME="'FMODModule'" -s MODULARIZE=1 -s FORCE_FILESYSTEM=1 -s EXTRA_EXPORTED_RUNTIME_METHODS="['cwrap','setValue','getValue']" -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -o fmodstudio.js fmodstudio.bc fmodstudio_bindings.bc
warning: overriding the module target triple with wasm32-unknown-emscripten [-Woverride-module]
1 warning generated.
warning: overriding the module target triple with wasm32-unknown-emscripten [-Woverride-module]
1 warning generated.
emcc: warning: EXTRA_EXPORTED_RUNTIME_METHODS is deprecated, please use EXPORTED_RUNTIME_METHODS instead [-Wdeprecated]
wasm-ld: warning: function signature mismatch: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED2Ev
>>> defined as (i32) -> void in /tmp/emscripten_temp_i0uzwob_/fmodstudio_bindings_1.o
>>> defined as (i32) -> i32 in /home/USERNAME/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc++-noexcept.a(string.o)

wasm-ld: error: /tmp/emscripten_temp_i0uzwob_/fmodstudio_bindings_1.o: undefined symbol: std::__2::__vector_base_common<true>::__throw_length_error() const
wasm-ld: error: /tmp/emscripten_temp_i0uzwob_/fmodstudio_bindings_1.o: undefined symbol: std::__2::__vector_base_common<true>::__throw_length_error() const
wasm-ld: error: /tmp/emscripten_temp_i0uzwob_/fmodstudio_bindings_1.o: undefined symbol: std::__2::__vector_base_common<true>::__throw_length_error() const
wasm-ld: error: /tmp/emscripten_temp_i0uzwob_/fmodstudio_bindings_1.o: undefined symbol: std::__2::__vector_base_common<true>::__throw_length_error() const

Wondering if anyone could help?

Hi,

Thank you for all the information. Unfortunately, 3.1.52 no longer supports fast comp.

Could you please elaborate on why you are building fmodstudio.js yourself rather than using our provided build? We may be able to find an alternative solution.

Hi, I use Defold game engine. There is a FMOD wrapper for lua to use with Defold.
In version 1.7.1, Defold updated from Emscripten version 2.02.2 to Emscripten 3.1.55, and that broke the FMOD for Defold HTML5, because it was outdated compared to Defold’s.

I want to compile the bitcode of FMOD 2.02.05 patch1 to a newer Emscripten version 3.1.55. Is that possible? Can I have access to bitcode that are not fastcomp?(since it’s outdated)

Please see the original issue here

Hi,

Thank you for bringing this to our attention. Unfortunately, I cannot provide those files. However, I have created a task to look into updating our Emscripten version.

Hi,

I am also very much interested in this topic, because I would love to use FMOD in my Defold project as well.
Unfortunately, due to the limitations above, I have to stay at a very outdated Defold version.

Is there any news on the plan to upgrade to a newer emscripten version?

Thank you

Hi,

We have recently upgraded the Emscripten version to the latest.

Please try updating your FMOD to 2.02.25. This should allow you to achieve what you’ve been aiming for now.

Let me know if the issue persists.