Issues with compiling for HTML5 using emscripten

I’m trying to export the Godot plugin for FMOD to HTML5, but I seem to be getting this kind of errors:

wasm-ld: error: /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a(fmod_asynccommandbuffer.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol .L.str.6; recompile with -fPIC

Does anyone know what the issue could be here?

Emscripten version: 2.0.16
FMOD version: 2.01.08

Command I’m using the create my WASM:

em++ -o bin/libGodotFmod.javascript.debug.wasm -s SIDE_MODULE=1 src/gdlibrary.bc src/godot_fmod.bc src/callback/event_callbacks.bc src/callback/file_callbacks.bc /mnt/c/Users/pietb/Documents/Repositories/Forks/godot-cpp/bin/libgodot-cpp.javascript.debug.wasm.bc /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a

The full error log:

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
em++ -o bin/libGodotFmod.javascript.debug.wasm -s SIDE_MODULE=1 src/gdlibrary.bc src/godot_fmod.bc src/callback/event_callbacks.bc src/callback/file_callbacks.bc /mnt/c/Users/pietb/Documents/Repositories/Forks/godot-cpp/bin/libgodot-cpp.javascript.debug.wasm.bc /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a
wasm-ld: error: /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a(fmod_asynccommand.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol .L.str.3; recompile with -fPIC
wasm-ld: error: /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a(fmod_asynccommand.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol .L.str; recompile with -fPIC
wasm-ld: error: /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a(fmod_asynccommand.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol .L.str.1; recompile with -fPIC
wasm-ld: error: /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a(fmod_asynccommand.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol .L.str.2; recompile with -fPIC
wasm-ld: error: /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a(fmod_asynccommand.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol .L.str; recompile with -fPIC
wasm-ld: error: /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a(fmod_asynccommand.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol .L.str; recompile with -fPIC
wasm-ld: error: /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a(fmod_asynccommandbuffer.o): relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol FMOD::gGlobal; recompile with -fPIC
wasm-ld: error: /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a(fmod_asynccommandbuffer.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol .L.str; recompile with -fPIC
wasm-ld: error: /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a(fmod_asynccommandbuffer.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol .L.str; recompile with -fPIC
wasm-ld: error: /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a(fmod_asynccommandbuffer.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol .L.str; recompile with -fPIC
wasm-ld: error: /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a(fmod_asynccommandbuffer.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol .L.str.1; recompile with -fPIC
wasm-ld: error: /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a(fmod_asynccommandbuffer.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol .L.str.2; recompile with -fPIC
wasm-ld: error: /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a(fmod_asynccommandbuffer.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol .L.str; recompile with -fPIC
wasm-ld: error: /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a(fmod_asynccommandbuffer.o): relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol FMOD::gGlobal; recompile with -fPIC
wasm-ld: error: /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a(fmod_asynccommandbuffer.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol .L.str; recompile with -fPIC
wasm-ld: error: /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a(fmod_asynccommandbuffer.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol .L.str.5; recompile with -fPIC
wasm-ld: error: /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a(fmod_asynccommandbuffer.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol .L.str; recompile with -fPIC
wasm-ld: error: /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a(fmod_asynccommandbuffer.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol .L.str.3; recompile with -fPIC
wasm-ld: error: /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a(fmod_asynccommandbuffer.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol .L.str.4; recompile with -fPIC
wasm-ld: error: /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a(fmod_asynccommandbuffer.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol .L.str.6; recompile with -fPIC
wasm-ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
em++: error: '/home/ponders/emsdk/upstream/bin/wasm-ld -o bin/libGodotFmod.javascript.debug.wasm --whole-archive src/gdlibrary.bc src/godot_fmod.bc src/callback/event_callbacks.bc src/callback/file_callbacks.bc /mnt/c/Users/pietb/Documents/Repositories/Forks/godot-cpp/bin/libgodot-cpp.javascript.debug.wasm.bc /mnt/c/Users/pietb/Documents/Repositories/Forks/libs/fmod/javascript/studio/lib/upstream/w32/fmodstudioL.a -L/home/ponders/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic --no-whole-archive -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --lto-legacy-pass-manager --allow-undefined --import-memory --strip-debug --export-all --no-gc-sections --experimental-pic -shared' failed (1)
scons: *** [bin/libGodotFmod.javascript.debug.wasm] Error 1
scons: building terminated because of errors.

I have not used Godot but I think this is not an FMOD specific issue.

See Experimenting with WebAssembly dynamic linking with clang

The comment at the bottom says that clang versions might be the reason for the problem.