Skip to content

dgettext fails: index out of bounds,___mo_lookup@ #9085

@zekoz

Description

@zekoz

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

#include <libintl.h>
#include <locale.h>
#include <stdio.h>

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions