All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] util-linux: add -lcurses to LDFLAGS when static linking
@ 2016-09-18 10:11 Chris Packham
  2016-09-19 12:51 ` Carlos Santos
  2016-09-19 17:21 ` Thomas Petazzoni
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Packham @ 2016-09-18 10:11 UTC (permalink / raw)
  To: buildroot

When linking statically with -lreadline we also need to specify
-lcurses.

Fixes:
  http://autobuild.buildroot.net/results/70e0a273e699c73c6b2ab2a19c8f7ebb1ddee6cde
  http://autobuild.buildroot.net/results/6a7faf8adbffd9437c0117b9f0e89684c24dad23

Signed-off-by: Chris Packham <judge.packham@gmail.com>
---
I think this should address the following build failures although I've only
confirmed the two quoted above.

  http://autobuild.buildroot.net/results/0c79588166e1900c18161e1d67a38e6ee2461112
  http://autobuild.buildroot.net/results/66fcd3dc6909bd00d6cb97e7b713e1e2e91c2697
  http://autobuild.buildroot.net/results/d31ea8d374fa4b14b8d8d55e537801c7fc1e5992
  http://autobuild.buildroot.net/results/9d4d9b74fb021fcbbc2a63ccc8cbe170ded7ae24
  http://autobuild.buildroot.net/results/e4f9e0549ddfca65d746cd7ac681cd463e86f6b7
  http://autobuild.buildroot.net/results/5f6b19e5fbb138b81092004ab8da057b84817025

I'm not sure that this is the "right" fix but it seems to do the trick. I also
tried using LIBS instead of LDFLAGS which got the configure step to pass but
didn't propagate to the final link.

 package/util-linux/util-linux.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/package/util-linux/util-linux.mk b/package/util-linux/util-linux.mk
index 82230bc..d32e30d 100644
--- a/package/util-linux/util-linux.mk
+++ b/package/util-linux/util-linux.mk
@@ -148,6 +148,8 @@ endif
 
 ifeq ($(BR2_PACKAGE_READLINE),y)
 UTIL_LINUX_CONF_OPTS += --with-readline
+UTIL_LINUX_CONF_ENV += $(if $(BR2_STATIC_LIBS),ac_cv_lib_readline_readline=yes)
+UTIL_LINUX_CONF_ENV += $(if $(BR2_STATIC_LIBS),LDFLAGS="-lcurses")
 UTIL_LINUX_DEPENDENCIES += readline
 else
 UTIL_LINUX_CONF_OPTS += --without-readline
-- 
2.9.2.518.ged577c6.dirty

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] util-linux: add -lcurses to LDFLAGS when static linking
  2016-09-18 10:11 [Buildroot] [PATCH] util-linux: add -lcurses to LDFLAGS when static linking Chris Packham
@ 2016-09-19 12:51 ` Carlos Santos
  2016-09-19 17:21 ` Thomas Petazzoni
  1 sibling, 0 replies; 3+ messages in thread
From: Carlos Santos @ 2016-09-19 12:51 UTC (permalink / raw)
  To: buildroot

> From: "Chris Packham" <judge.packham@gmail.com>
> To: buildroot at buildroot.org
> Sent: Sunday, September 18, 2016 7:11:41 AM
> Subject: [Buildroot] [PATCH] util-linux: add -lcurses to LDFLAGS when static	linking

> When linking statically with -lreadline we also need to specify
> -lcurses.
> 
> Fixes:
>  http://autobuild.buildroot.net/results/70e0a273e699c73c6b2ab2a19c8f7ebb1ddee6cde
>  http://autobuild.buildroot.net/results/6a7faf8adbffd9437c0117b9f0e89684c24dad23
> 
> Signed-off-by: Chris Packham <judge.packham@gmail.com>

Tested-by: Carlos Santos <casantos@datacom.ind.br>

> ---
> I think this should address the following build failures although I've only
> confirmed the two quoted above.
> 
>  http://autobuild.buildroot.net/results/0c79588166e1900c18161e1d67a38e6ee2461112
>  http://autobuild.buildroot.net/results/66fcd3dc6909bd00d6cb97e7b713e1e2e91c2697
>  http://autobuild.buildroot.net/results/d31ea8d374fa4b14b8d8d55e537801c7fc1e5992
>  http://autobuild.buildroot.net/results/9d4d9b74fb021fcbbc2a63ccc8cbe170ded7ae24
>  http://autobuild.buildroot.net/results/e4f9e0549ddfca65d746cd7ac681cd463e86f6b7
>  http://autobuild.buildroot.net/results/5f6b19e5fbb138b81092004ab8da057b84817025
> 
> I'm not sure that this is the "right" fix but it seems to do the trick. I also
> tried using LIBS instead of LDFLAGS which got the configure step to pass but
> didn't propagate to the final link.
> 
> package/util-linux/util-linux.mk | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/package/util-linux/util-linux.mk b/package/util-linux/util-linux.mk
> index 82230bc..d32e30d 100644
> --- a/package/util-linux/util-linux.mk
> +++ b/package/util-linux/util-linux.mk
> @@ -148,6 +148,8 @@ endif
> 
> ifeq ($(BR2_PACKAGE_READLINE),y)
> UTIL_LINUX_CONF_OPTS += --with-readline
> +UTIL_LINUX_CONF_ENV += $(if $(BR2_STATIC_LIBS),ac_cv_lib_readline_readline=yes)
> +UTIL_LINUX_CONF_ENV += $(if $(BR2_STATIC_LIBS),LDFLAGS="-lcurses")
> UTIL_LINUX_DEPENDENCIES += readline
> else
> UTIL_LINUX_CONF_OPTS += --without-readline
> --
> 2.9.2.518.ged577c6.dirty
> 

Confirmed that the change fixes the problem on x86_64.

Carlos Santos (Casantos)
DATACOM, P&D

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] util-linux: add -lcurses to LDFLAGS when static linking
  2016-09-18 10:11 [Buildroot] [PATCH] util-linux: add -lcurses to LDFLAGS when static linking Chris Packham
  2016-09-19 12:51 ` Carlos Santos
@ 2016-09-19 17:21 ` Thomas Petazzoni
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2016-09-19 17:21 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 18 Sep 2016 22:11:41 +1200, Chris Packham wrote:

> I'm not sure that this is the "right" fix but it seems to do the trick. I also
> tried using LIBS instead of LDFLAGS which got the configure step to pass but
> didn't propagate to the final link.

The reason why LIBS is not taken into account during the build is
because the configure does LIBS="" at the end. This is also why we're
already passing LIBS=-lintl at build time.

So at the end, I've committed the following fix:

diff --git a/package/util-linux/util-linux.mk
b/package/util-linux/util-linux.mk
index 82230bc..82a726e 100644
--- a/package/util-linux/util-linux.mk
+++ b/package/util-linux/util-linux.mk
@@ -49,13 +49,20 @@ endif
 
 ifeq ($(BR2_NEEDS_GETTEXT_IF_LOCALE),y)
 UTIL_LINUX_DEPENDENCIES += gettext
-UTIL_LINUX_MAKE_OPTS += LIBS=-lintl
+UTIL_LINUX_LIBS += -lintl
 endif
 
 ifeq ($(BR2_PACKAGE_LIBCAP_NG),y)
 UTIL_LINUX_DEPENDENCIES += libcap-ng
 endif
 
+# Unfortunately, the util-linux does LIBS="" at the end of its
+# configure script. So we have to pass the proper LIBS value when
+# calling the configure script to make configure tests pass properly,
+# and then pass it again at build time.
+UTIL_LINUX_CONF_ENV += LIBS="$(UTIL_LINUX_LIBS)"
+UTIL_LINUX_MAKE_OPTS += LIBS="$(UTIL_LINUX_LIBS)"
+
 # Used by cramfs utils
 UTIL_LINUX_DEPENDENCIES += $(if $(BR2_PACKAGE_ZLIB),zlib)
 
@@ -148,6 +155,7 @@ endif
 
 ifeq ($(BR2_PACKAGE_READLINE),y)
 UTIL_LINUX_CONF_OPTS += --with-readline
+UTIL_LINUX_LIBS += $(if $(BR2_STATIC_LIBS),-lcurses)
 UTIL_LINUX_DEPENDENCIES += readline
 else
 UTIL_LINUX_CONF_OPTS += --without-readline

It is worth mentioning that a much better fix would be for readline to
provide a pkg-config file, and have util-linux use it. The latest
version of readline (7.0) has a pkg-config file, but does not install
it. So for the time being, the above patch will hopefully do the trick.

Thanks for your initial investigation!

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-19 17:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-18 10:11 [Buildroot] [PATCH] util-linux: add -lcurses to LDFLAGS when static linking Chris Packham
2016-09-19 12:51 ` Carlos Santos
2016-09-19 17:21 ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.