emscripten-core/emscripten

Compiling with main_module override FETCH functions

Open

#11.390 geöffnet am 10. Juni 2020

Auf GitHub ansehen
 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C++ (3.519 Forks)batch import
good first bughelp wanted

Repository-Metriken

Stars
 (27.361 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 19T 10h) (147 gemergte PRs in 30 T)

Beschreibung

HI,

Compiling with the option -s MAIN_MODULE=1 on a C code that uses emscripten_fetch function (with -s FETCH = 1) provides this error :

external function '_emscripten_fetch_load_cached_data' is missing. perhaps a side module was not linked in? if this function was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment

The reason is that the js file generated with -s MAIN_MODULE=1 override this function : function __emscripten_fetch_load_cached_data(db, fetch, onsuccess, onerror)

with this : function __emscripten_fetch_load_cached_data( ) { if (!Module['__emscripten_fetch_load_cached_data']) abort("external function '_emscripten_fetch_load_cached_data' is missing. perhaps a side module was not linked in? if this function was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment"); return Module['__emscripten_fetch_load_cached_data'].apply(null, arguments); }

However, both functions are existing, and deleting the second one (the one that override __emscripten_fetch_load_cached_data) fix the issue.

This is surely a bug in the transpiling process, that set this function as a STDLIB function, which isn't.

Contributor Guide