emscripten-core / emscripten-core/emscripten

dgettext fails: index out of bounds,___mo_lookup@

Open
#9,085 7 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

Here is a minimal repro case, assuming you have vlc installed for the i18n files.

```
#include
#include
#include

int main(int argc, char **argv)
{
printf("%s\n", setlocale(LC_ALL, "fr"));
bindtextdomain("vlc", "/usr/share/locale");
textdomain("vlc");
printf("%s\n", dgettext("vlc", "ASCII Art"));
}
```
emcc intl.c -o intl-em.html -g4 --preload-file

/usr/share/locale/fr/LC_MESSAGES/vlc.mo@/usr/share/locale/fr/LC_MESSAGES/vlc.mo
exception thrown: RuntimeError: index out of bounds,___mo_lookup@http://localhost:6931/intl-em.js:9910:1
_dcngettext@http://localhost:6931/intl-em.js:34036:1
_dgettext@http://localhost:6931/intl-em.js:33154:1
_main@http://localhost:6931/intl-em.js:1419:1
Module._main@http://localhost:6931/intl-em.js:5440:10
callMain@http://localhost:6931/intl-em.js:5641:15
doRun@http://localhost:6931/intl-em.js:5699:42
run/<@http://localhost:6931/intl-em.js:5710:7

How do I even debug this? Is there a way for me to build libc with source maps so I can at least step through in the browser debugger?

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.