The Problem

Currently I am trying to get the official GDNative C++ example for Godot 3.5, which can be found here working in the Web Export context. So far, I managed to export to X11.64 without any troubles and managed to set up the creation pipeline for the Web Assembly (see section "Web Assembly Creation Process" below), which now produces a valid output without any error messages. However, as soon as I try to run the game in any browser, it stops loading and displays the following error message:

Aborted(To use dlopen, you need enable dynamic linking, 
see https://github.com/emscripten-core/emscripten/wiki/Linking)

This link only contains a link to the new documentation of emscripten, which is used to create the Web Assembly file, and is at the time of writing located at https://emscripten.org/docs/compiling/Dynamic-Linking.html.

Final File Structure

  |   └─lib/
  |      ├─wasm/
  |      |   └─libsimple.wasm
  |      ├─SimpleLibrary.gdnlib
  |      └─SimpleLibrary.gdns
      |    ├─bin/
      |    |  └─libgodot-cpp.javascript.release.wasm.a
      |    ├─include/
      |    |   ├─core/
      |    |   └─gen/
      |    └─godot-headers/
      |  └─libsimple.wasm

Web Assembly Creation and Export Process

At the beginning of the project (only necessary once):

  1. Initialize SimpleLibrary directory with godot-cpp and godot-headers.
  2. Create the release JavaScript Godot Binding via
    scons platform=javascript generate_bindings=yes target=release,
    which creates the archive SimpleLibrary/godot-cpp/bin/libgodot-cpp.javascript.release.wasm.a.
  3. Create GDNative Import Files in the Godot Project Directory.

After each change:

  1. Create the new Web Assembly Library
     cd SimpleLibrary
     emcc -o bin/libsimple.wasm -g -O3 -sSIDE_MODULE=1 src/init.cpp godot-cpp/bin/libgodot-cpp.javascript.release.wasm.a -Igodot-cpp/include -Igodot-cpp/include/core -Igodot-cpp/include/gen -Igodot-cpp/godot-headers
  2. Copy the newly created library to the correct location in the Godot Project Folder
   cp bin/libsimple.wasm ../godot-project-src/lib/wasm
  1. Update (if necessary) the GDNative Import Files in the Godot Project Directory.

Web Export

Just selecting the HTML Export Template via the Godot Editor, choosing the Export Folder and let Godot do its thing.


  1. Did I miss some necessary settings during the Web Assembly creation? I already had to change some compiler flags for emccand add include directories compared to the original example to get it even to compile. I also experimented with the optimization flags, the deprecated -shared flag, -sDYNAMIC_EXECUTION, -sMAIN_MODULE, but no changes.
  2. Do I have to create a custom HTML Export Template for this to work properly? According to the GDNative Documentation, if

are created properly, this should not be necessary.

  1. Is the GDNative C++ Web Export at all possible? During my research, I only found very vague documentation, a lot of (not really related) github issues and more questions than answers.

1 Answer 1


After some detailed checking of the emcc compiler flags and verifying their functionality in the documentation, I realized that the Godot Webexport does not produce the files required for the pseudo-shared library approach of emcc. After taking a close look at the official Godot 3.5 Documentation regarding Web Export Options, I found that I missed to set one property in the Godot HTML Export Template Settings.

Godot HTML Export Template Settings: Default

The documentation states clearly that for GDNative to work in the Web Export, the Export Type has to be set to GDNative.

Godot HTML Export Template Settings: Required

Now the Godot HTML Export includes the three according to the emcc documentation required .wasm files:

  1. The library itself libsimple.wasm,
  2. The side-loading library <PROJECT EXPORT NAME>.side.wasm,
  3. The main .wasm containing the default Godot functionality <PROJECT EXPORT NAME>.wasm.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .