# Issues with compiling for HTML5 using emscripten

**URL:** <https://qa.fmod.com/t/issues-with-compiling-for-html5-using-emscripten/17013>\
**Category:** FMOD Engine\
**Tags:** html5, cpp\
**Created:** [April 9, 2021, 2:01pm UTC](https://qa.fmod.com/t/issues-with-compiling-for-html5-using-emscripten/17013 "2021-04-09T14:01:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![2shady4u](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/2shady4u/32/2115_2.png) [@2shady4u](https://qa.fmod.com/u/2shady4u)\
**Post date:** [April 9, 2021, 2:01pm UTC](https://qa.fmod.com/t/issues-with-compiling-for-html5-using-emscripten/17013/1 "2021-04-09T14:01:30Z")

</div>

I’m trying to export the [Godot plugin](https://github.com/utopia-rise/fmod-gdnative) for FMOD to HTML5, but I seem to be getting this kind of errors:

```auto
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:

```auto
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:

```auto
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.

```

---

<div class="post-metadata">

**Author:** ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)\
**Post date:** [April 13, 2021, 2:51am UTC](https://qa.fmod.com/t/issues-with-compiling-for-html5-using-emscripten/17013/2 "2021-04-13T02:51:50Z")

</div>

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

See [Experimenting with WebAssembly dynamic linking with clang](https://iandouglasscott.com/2019/07/18/experimenting-with-webassembly-dynamic-linking-with-clang/)

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