emscripten-core / emscripten-core/emscripten

emscripten_dlopen fails on Safari

Open
#21,571 12 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Hello,

I recently implemented asynchronous dynamic modules support for my WASM project.
Loading is quite simple:
1. I download the module using fetch API.
2. store downloaded binary to virtual emscripten FS file.
3. asynchronously load and instantiate wasm .so file using function emscripten_dlopen.

Since loading is asynchronous - there are usually several modules in the fly, depending on assets.
The system works fine in chrome, but doesn't work in Safari (both MacOS and iOS).
It reports unresolved exported symbols in side modules. But problem is the symbols aren't related to those modules at all. They are located in other side modules.

For example it throws error for DdsImporter.so module:
bad export type for '_ZTVN4Tmrw4Data16GltfImporterE": undefined.
This symbol is just virtual functions table of Gltfimporter class which is not part of DdsImporter at all, and DdsImporter is not using it.
GltfImporter class is instantiated in another side module.

Safari always mixes the modules randomly during resolving symbols. Always throwing different resolving issues for different modules. There is no determinism.

There is example url to check the issue:
http://honya.myftp.org:88/wrooms/index.html?native_debug=true

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.