[Buildroot] libintl static linking issues - yet another spin

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Mon Apr 3 13:02:17 UTC 2017


Hello,

On Mon, 3 Apr 2017 14:45:12 +0200, Arnout Vandecappelle wrote:

>  And I guess musl also has it in a single libc? Yeah, I don't see a libintl
> there so I guess it's bundled.
> 
>  If we do enable the stubs in uClibc, and a packages links with -lintl, then in
> fact the full gettext will be used and the stubs are not even linked in
> (statically or dynamically), correct? In that case, we could indeed enable the
> stubs in uClibc. As a result, in static linking, any package that links with
> gettext but forgets an explicit -lintl will use the stubs instead of the full
> implementation. So the package still works, but without translations.

Does this actually work? Won't the linker complain about conflicting
symbols between libintl and libc? Are weak symbols in libc also working
in static linking scenarios?

>  As a side note, pretty much independent of this issue: I wonder if our
> BR2_NEEDS_GETTEXT_IF_LOCALE approach really is the right thing to do. It
> basically says: if a package is able to use translations, we force translations
> (by enabling gettext). Wouldn't it be much more appropriate to remove all those
> selects from Config.in, and instead just add to _DEPENDENCIES:
> $(if $(BR2_PACKAGE_GETTEXT),gettext) ? That allows the user to choose whether or
> not they want translations.

No, that's not what BR2_NEEDS_GETTEXT_IF_LOCALE says. What
BR2_NEEDS_GETTEXT_IF_LOCALE is really what it means: the package really
absolutely NEEDS gettext to be available if locale support is available
in the toolchain. I.e, with locale support enabled, the package would
*NOT* build if gettext is not available.

Of course, there might be incorrect uses of BR2_NEEDS_GETTEXT_IF_LOCALE
that don't follow this rule, and they should be fixed as you suggest,
but BR2_NEEDS_GETTEXT_IF_LOCALE remains needed for the case I explained
above. See the documentation:

"""
Packages that need gettext only when locale support is enabled should:

    use select BR2_PACKAGE_GETTEXT if BR2_NEEDS_GETTEXT_IF_LOCALE in
    the Config.in file; 
"""

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com



More information about the buildroot mailing list