0 votes

I compiled my GDN library for javascript target using emscripten and connected it to the game. But after export into HTML5, my game can't find the library file. Looks like it missing and not exported. How to add it to game package?

The same situation if I just load game in browser by Run HTML5 button from Editor.

What is wrong?

The project files: https://drive.google.com/file/d/1v6IvSD60O2rKpSI6IFWs6BUU2ThkoLEZ/view?usp=sharing

index.js:362 ERROR: Can't open dynamic library: bin/javascript64/TinyRTSGDNative.wasm. Error: Could not load dynamic lib: TinyRTSGDNative.wasm
index.js:362 Error: TinyRTSGDNative.wasm: file not found, and synchronous loading of external files is not available
index.js:362    at: open_dynamic_library (platform/javascript/os_javascript.cpp:1054) - Condition "!p_library_handle" is true. Returned: ERR_CANT_OPEN
index.js:362 ERROR: No valid library handle, can't get symbol from GDNative object
index.js:362    at: get_symbol (modules/gdnative/gdnative.cpp:510) - No valid library handle, can't get symbol from GDNative object
index.js:362 ERROR: No nativescript_init in "res://bin/javascript64/TinyRTSGDNative.wasm" found
index.js:362    at: init_library (modules/gdnative/nativescript/nativescript.cpp:1510) - No nativescript_init in "res://bin/javascript64/TinyRTSGDNative.wasm" found
Godot version latest
in Engine by (274 points)
edited by

2 Answers

0 votes
Best answer

I found what was wrong. Problem was caused by two factors:

  1. using library resource as subresource instead of gdnlib file.
    I created gdnlib file with path to libraries for different platforms
    and included it to gdns file instead of subresource. It helped.
  2. the latest emscripten version on the windows.
    I used 3.1.9 before and then downgraded to 2.0.12. It helped.
by (274 points)
0 votes

Was the file "TinyRTSGDNative.wasm" added to the project, or was it generated by the engine? If it was added, the file will have to be manually added when the game is exported.

When exporting the game (by going to the editor and selecting Project -> Export..., then selecting the export preset), a file can be added to the game package. In the Export dialog, click on the Resources tab and then enter the file that needs to be exported. In this case, it would be "TinyRTSGDNative.wasm" (without the quotes).

Optional files to export

That should export the game along with the desired file. If entering just the file name doesn't work, it may also need the path to the file, i.e. bin/javascript64/TinyRTSGDNative.wasm.

by (3,144 points)

No, it didn't help. And what is about the HTML5 Run in browser button at Editor. How the export settings related to it?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.