util-linux: add -lcurses to LDFLAGS when static linking
PATCH 1/1 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
---
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(+)
package/util-linux/util-linux.mk +2 -0
@@ -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
Signature · 1 line
2.9.2.518.ged577c6.dirty
PATCH 1/1 util-linux: add -lcurses to LDFLAGS when static linking
Quoted 5 lines
From: "Chris Packham" <[email protected]>
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
Quoted 8 lines
When linking statically with -lreadline we also need to specify -lcurses.
Fixes:
http://autobuild.buildroot.net/results/70e0a273e699c73c6b2ab2a19c8f7ebb1ddee6cde
http://autobuild.buildroot.net/results/6a7faf8adbffd9437c0117b9f0e89684c24dad23Signed-off-by Chris Packham <[email protected]>
Quoted 28 lines
---
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/5f6b19e5fbb138b81092004ab8da057b84817025I'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(+)package/util-linux/util-linux.mk +0
-0@@ -148,6 +148,8 @@ endif ifeq ($(BR2_PACKAGE_READLINE),y)
UTIL_LINUX_CONF_OPTS+= --with-readlinepackage/util-linux/util-linux.mk +2
-0+UTIL_LINUX_CONF_ENV += $(if $(BR2_STATIC_LIBS),ac_cv_lib_readline_readline=yes) +UTIL_LINUX_CONF_ENV += $(if $(BR2_STATIC_LIBS),LDFLAGS="-lcurses")
Quoted 6 lines
UTIL_LINUX_DEPENDENCIES+= readline
elseUTIL_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
PATCH 1/1 util-linux: add -lcurses to LDFLAGS when static linking
In reply to Chris PackhamHello,
Quoted 3 lines · Chris Packham
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:
(quoted diff) +0 -0
b/package/util-linux/util-linux.mk
index 82230bc..82a726e 100644
package/util-linux/util-linux.mk +9 -1
@@ -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
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com