Skip to contentSkip to conversation

package/zeromq: disable libbsd on static build

PATCH New Fabrice Fontaine 2 participants 2 messages Jan 30, 2021 – Jan 31, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/zeromq: disable libbsd on static build

Static linking with libbsd fails because of multiple definition of the strlcpy symbol. uClibc optionally provides these symbols.

So disable libbsd on zeromq when linking statically to avoid the following build failure with bitcoin and zeromq:

CXXLD bitcoind
/tmp/instance-1/output-1/host/lib/gcc/powerpc-buildroot-linux-uclibc/9.3.0/../../../../powerpc-buildroot-linux-uclibc/bin/ld: /tmp/instance-1/output-1/host/powerpc-buildroot-linux-uclibc/sysroot/usr/lib//libc.a(strlcpy.os): in function `__GI_strlcpy':
strlcpy.c:(.text+0x0): multiple definition of `strlcpy'; /tmp/instance-1/output-1/host/powerpc-buildroot-linux-uclibc/sysroot/usr/lib/libbsd.a(strlcpy.o):strlcpy.c:(.text+0x0): first defined here

Fixes:
- http://autobuild.buildroot.org/results/ba87544d42ad5e77a27a7a504bc6336a06f6e291

---
 package/zeromq/zeromq.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/zeromq/zeromq.mk +1 -1
index 182699403c..495f1aa5a3 100644
@@ -68,7 +68,7 @@ else
 ZEROMQ_CONF_OPTS += --without-tls
 endif
 
-ifeq ($(BR2_PACKAGE_LIBBSD),y)
+ifeq ($(BR2_PACKAGE_LIBBSD):$(BR2_STATIC_LIBS),y:)
 ZEROMQ_DEPENDENCIES += host-pkgconf libbsd
 ZEROMQ_CONF_OPTS += --enable-libbsd
 else
Signature · 1 line
2.29.2
#1 lore raw

PATCH 1/1 package/zeromq: disable libbsd on static build

Quoted 6 lines · On Sat, 30 Jan 2021 14:32:01 +0100 Fabrice Fontaine…

Static linking with libbsd fails because of multiple definition of the strlcpy symbol. uClibc optionally provides these symbols.

So disable libbsd on zeromq when linking statically to avoid the following build failure with bitcoin and zeromq:

Quoted 8 lines

CXXLD bitcoind
/tmp/instance-1/output-1/host/lib/gcc/powerpc-buildroot-linux-uclibc/9.3.0/../../../../powerpc-buildroot-linux-uclibc/bin/ld: /tmp/instance-1/output-1/host/powerpc-buildroot-linux-uclibc/sysroot/usr/lib//libc.a(strlcpy.os): in function `__GI_strlcpy':
strlcpy.c:(.text+0x0): multiple definition of `strlcpy'; /tmp/instance-1/output-1/host/powerpc-buildroot-linux-uclibc/sysroot/usr/lib/libbsd.a(strlcpy.o):strlcpy.c:(.text+0x0): first defined here

Fixes:
- http://autobuild.buildroot.org/results/ba87544d42ad5e77a27a7a504bc6336a06f6e291

We already fixed something similar for stress-ng in commit f2d6c5ff9092aa7735c7a739d15180910ae734df. So I'm wondering if we don't need a more general solution to this.

Indeed, libbsd seems to define its symbols regardless of what the C library provides, so obviously this is always going to cause multiple definitions build failures.

So should libbsd only define functions if not provided by the C library ? Or should libbsd be made "depends on !BR2_STATIC_LIBS" ?

Best regards,

Thomas

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