Meson NLS checking and cross compiling with Buildroot throws linking errors.
http://autobuild.buildroot.net/?reason=libglib2-2.60.3 Glib was just updated to 2.60.3 in the Buildroot project, and it seems that with following combination, linking to libintl doesn't work:
- meson
- either musl or uclibc
- gettext cross-compiled as a dependency.
Each build-end.log ends in the exact same way:
ggettext.c:(.text+0x34): undefined reference to `libintl_textdomain'
ggettext.c:(.text+0x44): undefined reference to `libintl_gettext'
glib/4430778@@glib-2.0@sha/ggettext.c.o: In function `ensure_gettext_initialized':
ggettext.c:(.text+0x170): undefined reference to `libintl_bindtextdomain'
ggettext.c:(.text+0x180): undefined reference to `libintl_bind_textdomain_codeset'
glib/4430778@@glib-2.0@sha/ggettext.c.o: In function `g_dgettext':
ggettext.c:(.text+0x1f8): undefined reference to `libintl_dgettext'
glib/4430778@@glib-2.0@sha/ggettext.c.o: In function `g_dcgettext':
ggettext.c:(.text+0x3cc): undefined reference to `libintl_dcgettext'
glib/4430778@@glib-2.0@sha/ggettext.c.o: In function `g_dngettext':
ggettext.c:(.text+0x41c): undefined reference to `libintl_dngettext'
I was able to track the issue down to https://gitlab.gnome.org/GNOME/glib/blob/master/meson.build#L1788
Specifically, the else statement in our case actually works, even though the compiler has the function ngettext.
If I change the logic to something like:
if cc.has_function('ngettext')
libintl = cc.find_library('intl', required : false)
if libintl.found()
have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset',
dependencies : libintl)
else
libintl = []
have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset')
endif
else
libintl = cc.find_library('intl', required : false)
if not libintl.found()
libintl = subproject('proxy-libintl').get_variable('intl_dep')
have_bind_textdomain_codeset = true # proxy-libintl supports it
else
have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset',
dependencies : libintl)
endif
endif
I am able to compile and link, although this probably isn't the best solution.
Any help with fixing this would be greatly appreciated!
Adam