diff mbox

[1/2] package/util-linux: libuuid needs -lintl

Message ID 16c19005f9076a857c9082f1f6fbe6617a1ec9a6.1417276704.git.yann.morin.1998@free.fr
State Accepted
Commit a535a0eada223a0eb8b2421ebe4a4246bb714b74
Headers show

Commit Message

Yann E. MORIN Nov. 29, 2014, 3:59 p.m. UTC
When gettext is needed (with locales), libuuid needs to be linked
against -lintl.

In dynamic link, this is solved via the DT_NEEDED ELF tag, but for
static links, it does not get pulled in automatically.

fix that by adding a Libs.private section to uid.pc, but only if
it needed.

First part at fixing:
    http://autobuild.buildroot.net/results/c46/c467aeec258909bb82eda77123803944f97d8df8/

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/util-linux/util-linux.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Baruch Siach Nov. 29, 2014, 6:04 p.m. UTC | #1
Hi Yann,

On Sat, Nov 29, 2014 at 04:59:57PM +0100, Yann E. MORIN wrote:
> When gettext is needed (with locales), libuuid needs to be linked
> against -lintl.
> 
> In dynamic link, this is solved via the DT_NEEDED ELF tag, but for
> static links, it does not get pulled in automatically.
> 
> fix that by adding a Libs.private section to uid.pc, but only if

s/uid/uuid/

baruch

> it needed.
> 
> First part at fixing:
>     http://autobuild.buildroot.net/results/c46/c467aeec258909bb82eda77123803944f97d8df8/
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  package/util-linux/util-linux.mk | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/package/util-linux/util-linux.mk b/package/util-linux/util-linux.mk
> index 6ecd16d..dc10193 100644
> --- a/package/util-linux/util-linux.mk
> +++ b/package/util-linux/util-linux.mk
> @@ -128,6 +128,14 @@ endif
>  
>  UTIL_LINUX_POST_INSTALL_TARGET_HOOKS += UTIL_LINUX_GETTY_SYMLINK
>  
> +ifeq ($(BR2_NEEDS_GETTEXT_IF_LOCALE)$(BR2_PACKAGE_UTIL_LINUX_LIBUUID),yy)
> +define UTIL_LINUX_TWEAK_UUID_PC
> +	$(SED) '/Libs\.private: .*/d' $(STAGING_DIR)/usr/lib/pkgconfig/uuid.pc
> +	printf "Libs.private: -lintl\n" >>$(STAGING_DIR)/usr/lib/pkgconfig/uuid.pc
> +endef
> +UTIL_LINUX_POST_INSTALL_TARGET_HOOKS += UTIL_LINUX_TWEAK_UUID_PC
> +endif
> +
>  $(eval $(autotools-package))
>  $(eval $(host-autotools-package))
Yann E. MORIN Nov. 29, 2014, 6:12 p.m. UTC | #2
Baruch, All,

On 2014-11-29 20:04 +0200, Baruch Siach spake thusly:
> On Sat, Nov 29, 2014 at 04:59:57PM +0100, Yann E. MORIN wrote:
> > When gettext is needed (with locales), libuuid needs to be linked
> > against -lintl.
> > 
> > In dynamic link, this is solved via the DT_NEEDED ELF tag, but for
> > static links, it does not get pulled in automatically.
> > 
> > fix that by adding a Libs.private section to uid.pc, but only if
> 
> s/uid/uuid/

Fixed, thanks!

Regards,
Yann E. MORIN.
Yann E. MORIN Nov. 30, 2014, 11:57 a.m. UTC | #3
Thomas, Peter, All,

On 2014-11-29 16:59 +0100, Yann E. MORIN spake thusly:
> When gettext is needed (with locales), libuuid needs to be linked
> against -lintl.
> 
> In dynamic link, this is solved via the DT_NEEDED ELF tag, but for
> static links, it does not get pulled in automatically.
> 
> fix that by adding a Libs.private section to uid.pc, but only if
> it needed.
> 
> First part at fixing:
>     http://autobuild.buildroot.net/results/c46/c467aeec258909bb82eda77123803944f97d8df8/
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  package/util-linux/util-linux.mk | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/package/util-linux/util-linux.mk b/package/util-linux/util-linux.mk
> index 6ecd16d..dc10193 100644
> --- a/package/util-linux/util-linux.mk
> +++ b/package/util-linux/util-linux.mk
> @@ -128,6 +128,14 @@ endif
>  
>  UTIL_LINUX_POST_INSTALL_TARGET_HOOKS += UTIL_LINUX_GETTY_SYMLINK
>  
> +ifeq ($(BR2_NEEDS_GETTEXT_IF_LOCALE)$(BR2_PACKAGE_UTIL_LINUX_LIBUUID),yy)
> +define UTIL_LINUX_TWEAK_UUID_PC
> +	$(SED) '/Libs\.private: .*/d' $(STAGING_DIR)/usr/lib/pkgconfig/uuid.pc
> +	printf "Libs.private: -lintl\n" >>$(STAGING_DIR)/usr/lib/pkgconfig/uuid.pc
> +endef
> +UTIL_LINUX_POST_INSTALL_TARGET_HOOKS += UTIL_LINUX_TWEAK_UUID_PC
> +endif

We've been discussing this on IRC, that we should come up with a patch
that could be upstreamable. Unfortunately, I have no idea on how to do
that...

It all boils down to util-linux not using the standard expansion
mechanism of autoconf (i.e. to replace @VARIABLE@ in .in files with the
value detected by ./configure).

Also, the way they are checking for gettext is way beyond my
understanding (well, I think I grasped most of it), and they have no
variable that expressly states whether -lintl is needed, just a LIBINTL
variable that contains whatever must be used to link with the
gettext-providing library.

The amount of work to fix that is way above the time left before our
release, so I believe we should go with that patch for now, and revisit
it later when we have some more time.

Opinions?

>  $(eval $(autotools-package))
>  $(eval $(host-autotools-package))
>  
> -- 
> 1.9.1
>
diff mbox

Patch

diff --git a/package/util-linux/util-linux.mk b/package/util-linux/util-linux.mk
index 6ecd16d..dc10193 100644
--- a/package/util-linux/util-linux.mk
+++ b/package/util-linux/util-linux.mk
@@ -128,6 +128,14 @@  endif
 
 UTIL_LINUX_POST_INSTALL_TARGET_HOOKS += UTIL_LINUX_GETTY_SYMLINK
 
+ifeq ($(BR2_NEEDS_GETTEXT_IF_LOCALE)$(BR2_PACKAGE_UTIL_LINUX_LIBUUID),yy)
+define UTIL_LINUX_TWEAK_UUID_PC
+	$(SED) '/Libs\.private: .*/d' $(STAGING_DIR)/usr/lib/pkgconfig/uuid.pc
+	printf "Libs.private: -lintl\n" >>$(STAGING_DIR)/usr/lib/pkgconfig/uuid.pc
+endef
+UTIL_LINUX_POST_INSTALL_TARGET_HOOKS += UTIL_LINUX_TWEAK_UUID_PC
+endif
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))