Skip to contentSkip to conversation

package/x11r7/xlib_libXfont2: disable usage of libbsd

PATCH New Bernd Kuhls 2 participants 2 messages Oct 1, 2019 – Oct 2, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/x11r7/xlib_libXfont2: disable usage of libbsd

Upstream added optional support for libbsd:
"Add strlcat & strlcpy fallbacks if not provided by libc nor libbsd"
https://cgit.freedesktop.org/xorg/lib/libXfont/commit/?id=d4c941ea8b1dc07a14efce656bff58d31a14c985

In the case that libbsd was built before xlib_libXfont2 it gets picked up by configure:

checking for library containing strlcat... -lbsd
checking for reallocarray... yes
checking for strlcat... yes
checking for strlcpy... yes

which leads to build errors.

Building without libbsd being built before succeeds:

checking for library containing strlcat... no
checking for reallocarray... yes
checking for strlcat... no
checking for strlcpy... no

Instead of fixing a problem in the xlib_libXfont2 code we disable the usage of libbsd altogether:

checking for library containing strlcat... (cached) no

and force xlib_libXfont2 to use its internal headers.

Fixes:
http://autobuild.buildroot.net/results/165/165f9f948419fc69fbf6b9281d759b37bb7d40c6/

---
 package/x11r7/xlib_libXfont2/xlib_libXfont2.mk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
package/x11r7/xlib_libXfont2/xlib_libXfont2.mk +3 -1
index cc3f474c64..30d27b40e6 100644
@@ -33,7 +33,9 @@ ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_85180),y)
 XLIB_LIBXFONT2_CFLAGS += -O0
 endif
 
-XLIB_LIBXFONT2_CONF_ENV = CFLAGS="$(XLIB_LIBXFONT2_CFLAGS)"
+XLIB_LIBXFONT2_CONF_ENV = \
+	CFLAGS="$(XLIB_LIBXFONT2_CFLAGS)" \
+	ac_cv_search_strlcat=no
 
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 package/x11r7/xlib_libXfont2: disable usage of libbsd

Hello Bernd,

Quoted 24 lines · On Tue, 1 Oct 2019 07:42:10 +0200 Bernd Kuhls <[email protected]> wrote:

Upstream added optional support for libbsd:
"Add strlcat & strlcpy fallbacks if not provided by libc nor libbsd"
https://cgit.freedesktop.org/xorg/lib/libXfont/commit/?id=d4c941ea8b1dc07a14efce656bff58d31a14c985

In the case that libbsd was built before xlib_libXfont2 it gets picked up by configure:

checking for library containing strlcat... -lbsd
checking for reallocarray... yes
checking for strlcat... yes
checking for strlcpy... yes

which leads to build errors.

Building without libbsd being built before succeeds:

checking for library containing strlcat... no
checking for reallocarray... yes
checking for strlcat... no
checking for strlcpy... no

Instead of fixing a problem in the xlib_libXfont2 code we disable the usage of libbsd altogether:

Quoted 8 lines

checking for library containing strlcat... (cached) no

and force xlib_libXfont2 to use its internal headers.

Fixes:
http://autobuild.buildroot.net/results/165/165f9f948419fc69fbf6b9281d759b37bb7d40c6/

As usual, I am not a big fan of hacks like this. What about fixing the real problem? It seems like the real problem is that HAVE_LIBBSD is never defined, and that:

configure.ac +2 -1
index f507c28..131713d 100644
@@ -52,7 +52,8 @@ AC_CHECK_HEADERS([endian.h poll.h sys/poll.h])
 
 # Checks for library functions.
 AC_CHECK_FUNCS([poll readlink])
-AC_SEARCH_LIBS([strlcat], [bsd])
+AC_SEARCH_LIBS([strlcat], [bsd],
+  [AC_DEFINE(HAVE_LIBBSD,1,[Has libbsd])])
 AC_CONFIG_LIBOBJ_DIR([src/util])
 AC_REPLACE_FUNCS([reallocarray strlcat strlcpy])
 

fixes it. Could you use this instead and send it upstream ?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com