Skip to content

Web export fails with dlsym() Assertion #105766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
marcosc90 opened this issue Apr 25, 2025 · 6 comments · Fixed by #105768
Closed

Web export fails with dlsym() Assertion #105766

marcosc90 opened this issue Apr 25, 2025 · 6 comments · Fixed by #105768

Comments

@marcosc90
Copy link
Contributor

marcosc90 commented Apr 25, 2025

Tested versions

Reproducible in master, the regression was introduced in #97002

System information

Godot v4.4.1.stable - Ubuntu 24.04.2 LTS 24.04 on X11 - X11 display driver, Multi-window, 2 monitors - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 4070 Laptop GPU - 13th Gen Intel(R) Core(TM) i9-13900H (20 threads)

Issue description

When exporting Godot to WebAssembly using an export template built with dlink_enabled=yes it fails at runtime with:

Aborted(Assertion failed: Tried to dlsym() from an unopened handle: -1)

Image

cc/ @adamscott

Steps to reproduce

  1. Build web export template with dlink_enabled=yes
scons platform=web target=template_release dlink_enabled=yes use_threads=yes
  1. Open any project and export for web (using the above template)
  2. Run the project
Aborted(Assertion failed: Tried to dlsym() from an unopened handle: -1)

Minimal reproduction project (MRP)

Default project

@adamscott
Copy link
Member

cc. @dsnopek

@dsnopek
Copy link
Contributor

dsnopek commented Apr 25, 2025

I have a theory!

dlsym() is a no-op without dlink_enabled=yes, but with it, dlsym() will try to actually load a symbol.

OS_Web descends from OS_Unix and I think it's OS_Unix::_load_iconv() running that's causing the error

All that stuff is wrapped in #ifndef __GLIBC__, but we probably want to wrap it in #if !defined(__GLIBC__) && !defined(WEB_ENABLED) instead.

I haven't done any testing to confirm

@marcosc90
Copy link
Contributor Author

I think it's OS_Unix::_load_iconv() running that's causing the error

Yes, this is correct

@marcosc90
Copy link
Contributor Author

marcosc90 commented Apr 25, 2025

For web builds, AFAIK iconv can be statically linked (though I don’t think it’ll be worth it), a polyfill can be used to implement the new methods, or support can be dropped entirely (at least temporarily) for:

String.to_multibyte_char_buffer(encoding)
PackedByteArray.get_string_from_multibyte_char(encoding)

@dsnopek
Copy link
Contributor

dsnopek commented Apr 25, 2025

For web builds, AFAIK iconv can be statically linked

I think Emscripten has builtin support for iconv, we just need to not try to load it dynamically.

FYI, I've reproduced the issue and I'm testing a fix. I'll post a PR soon!

@dsnopek
Copy link
Contributor

dsnopek commented Apr 25, 2025

I just posted PR #105768 which fixes the issue for me! Please let me know if it works for you as well :-)

@Repiteo Repiteo added this to the 4.5 milestone Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants