mosra / magnum

Lightweight and modular C++11 graphics middleware for games and data visualization
https://magnum.graphics/
Other
4.74k stars 439 forks source link

Emscripten 3.1.21+ crashes EmscriptenApplication: "AsciiToString is not defined" #619

Closed lacyyy closed 10 months ago

lacyyy commented 1 year ago

I'm trying to get code from the ImGui Emscripten example to work, I'm compiling on Windows. The app throws an error upon calling Magnum::ImGuiIntegration::Context::updateApplicationCursor(). Commenting out that call prevents that, but the cursor appearance obviously no longer changes.

image

It works flawlessly when compiled on Emscripten 3.1.20 . Looking at Emscripten's changelogs, version 3.1.21 deprecated a few runtime functions, including AsciiToString.

Squareys commented 1 year ago

There is UTF8ToString that can probably be used instead.

mosra commented 10 months ago

This is fixed as of 25ebe436f1984c3992a9d24b138ede33f5683d2d. I'm currently testing with 3.1.44 and finding tons of regressions in Emscripten itself, but this particular feature works now.

mosra commented 10 months ago

Turns out that the UTF8ToString, _malloc etc. isn't guaranteed to be included either. For a lack of easier options I'm going to fix this with an accompanying JS library that directly specifies its runtime dependencies.

mosra commented 10 months ago

A better solution is implemented in c3422cdd6ba520ab6eeeeb6d4719c03837fb7d99. This should also survive Emscripten versions 3.1.35+, which make UTF8ToString optional as well.