Skip to contentSkip to conversation

package/avahi: fix gettext dependency handling

PATCH New Bernd Kuhls 3 participants 3 messages Feb 12, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/avahi: fix gettext dependency handling

Currently avahi only adds -lintl when BR2_NEEDS_GETTEXT_IF_LOCALE is enabled. This is insufficent for defconfigs where BR2_PACKAGE_GETTEXT was selected by other packages without BR2_NEEDS_GETTEXT_IF_LOCALE being enabled at the same time. If gettext was built before avahi, and avahi uses optional dbus support, avahi configure detects libintl:

checking libintl.h usability... yes
checking libintl.h presence... yes
checking for libintl.h... yes
checking for ngettext in libc... no
checking for bindtextdomain in -lintl... yes
checking for ngettext in -lintl... yes
checking for dgettext in -lintl... yes

and breaks at linking stage:

CCLD avahi-publish
/home/buildroot/br7_freeswitch/output/host/usr/lib/gcc/i586-buildroot-linux-uclibc/5.4.0/../../../../i586-buildroot-linux-uclibc/bin/ld: avahi_publish-avahi-publish.o: undefined reference to symbol 'libintl_dgettext' /home/buildroot/br7_freeswitch/output/host/usr/i586-buildroot-linux-uclibc/sysroot/usr/lib32/libintl.so.8: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

To reproduce use this minimal defconfig:

BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
BR2_PACKAGE_GETTEXT=y
BR2_PACKAGE_DBUS=y
BR2_PACKAGE_AVAHI=y

and build gettext before avahi.

---
 package/avahi/avahi.mk | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
package/avahi/avahi.mk +5 -4
index 069b45a96..901beaaba 100644
@@ -96,9 +96,7 @@ AVAHI_CONF_OPTS = \
 	--with-autoipd-user=avahi \
 	--with-autoipd-group=avahi
 
-AVAHI_DEPENDENCIES = \
-	$(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),gettext) host-intltool \
-	host-pkgconf host-gettext
+AVAHI_DEPENDENCIES = host-intltool host-pkgconf host-gettext
 
 AVAHI_CFLAGS = $(TARGET_CFLAGS)
 
@@ -168,7 +166,10 @@ endif
 
 AVAHI_CONF_ENV += CFLAGS="$(AVAHI_CFLAGS)"
 
-AVAHI_MAKE_OPTS += $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),LIBS=-lintl)
+ifeq ($(BR2_PACKAGE_GETTEXT),y)
+AVAHI_DEPENDENCIES += gettext
+AVAHI_CONF_ENV += LIBS=-lintl
+endif
 
 define AVAHI_USERS
 	avahi -1 avahi -1 * - - -
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 package/avahi: fix gettext dependency handling

Hi Bernd,

Quoted 51 lines · Bernd Kuhls

Currently avahi only adds -lintl when BR2_NEEDS_GETTEXT_IF_LOCALE is enabled. This is insufficent for defconfigs where BR2_PACKAGE_GETTEXT was selected by other packages without BR2_NEEDS_GETTEXT_IF_LOCALE being enabled at the same time. If gettext was built before avahi, and avahi uses optional dbus support, avahi configure detects libintl:

checking libintl.h usability... yes
checking libintl.h presence... yes
checking for libintl.h... yes
checking for ngettext in libc... no
checking for bindtextdomain in -lintl... yes
checking for ngettext in -lintl... yes
checking for dgettext in -lintl... yes

and breaks at linking stage:

CCLD avahi-publish
/home/buildroot/br7_freeswitch/output/host/usr/lib/gcc/i586-buildroot-linux-uclibc/5.4.0/../../../../i586-buildroot-linux-uclibc/bin/ld: avahi_publish-avahi-publish.o: undefined reference to symbol 'libintl_dgettext' /home/buildroot/br7_freeswitch/output/host/usr/i586-buildroot-linux-uclibc/sysroot/usr/lib32/libintl.so.8: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

To reproduce use this minimal defconfig:

BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
BR2_PACKAGE_GETTEXT=y
BR2_PACKAGE_DBUS=y
BR2_PACKAGE_AVAHI=y

and build gettext before avahi.

---
 package/avahi/avahi.mk | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
package/avahi/avahi.mk +1 -3
index 069b45a96..901beaaba 100644
@@ -96,9 +96,7 @@ AVAHI_CONF_OPTS = \
 	--with-autoipd-user=avahi \
 	--with-autoipd-group=avahi
 
-AVAHI_DEPENDENCIES = \
-	$(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),gettext) host-intltool \
-	host-pkgconf host-gettext
+AVAHI_DEPENDENCIES = host-intltool host-pkgconf host-gettext
 
 AVAHI_CFLAGS = $(TARGET_CFLAGS)
 

package/avahi/avahi.mk endif · line 172

Quoted 8 lines
package/avahi/avahi.mk +4 -1
@@ -168,7 +166,10 @@ endif
 
 AVAHI_CONF_ENV += CFLAGS="$(AVAHI_CFLAGS)"
 
-AVAHI_MAKE_OPTS += $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),LIBS=-lintl)
+ifeq ($(BR2_PACKAGE_GETTEXT),y)
+AVAHI_DEPENDENCIES += gettext
+AVAHI_CONF_ENV += LIBS=-lintl
+endif

Why do you switch from AVAHI_MAKE_OPTS to AVAHI_CONF_ENV?

<PKG>_CONF_ENV is arguably better, but this change is not mentioned in the commit log.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
#2 lore raw

PATCH 1/1 package/avahi: fix gettext dependency handling

In reply to Bernd Kuhls

Hello,

Quoted 23 lines · Bernd Kuhls

Currently avahi only adds -lintl when BR2_NEEDS_GETTEXT_IF_LOCALE is enabled. This is insufficent for defconfigs where BR2_PACKAGE_GETTEXT was selected by other packages without BR2_NEEDS_GETTEXT_IF_LOCALE being enabled at the same time. If gettext was built before avahi, and avahi uses optional dbus support, avahi configure detects libintl:

checking libintl.h usability... yes
checking libintl.h presence... yes
checking for libintl.h... yes
checking for ngettext in libc... no
checking for bindtextdomain in -lintl... yes
checking for ngettext in -lintl... yes
checking for dgettext in -lintl... yes

and breaks at linking stage:

CCLD avahi-publish
/home/buildroot/br7_freeswitch/output/host/usr/lib/gcc/i586-buildroot-linux-uclibc/5.4.0/../../../../i586-buildroot-linux-uclibc/bin/ld: avahi_publish-avahi-publish.o: undefined reference to symbol 'libintl_dgettext' /home/buildroot/br7_freeswitch/output/host/usr/i586-buildroot-linux-uclibc/sysroot/usr/lib32/libintl.so.8: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

To reproduce use this minimal defconfig:

Quoted 8 lines

BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
BR2_PACKAGE_GETTEXT=y
BR2_PACKAGE_DBUS=y
BR2_PACKAGE_AVAHI=y

and build gettext before avahi.

I haven't looked at your patch yet, but there is another patch pending in patchwork for what looks like the same issue, and some discussion took place on it: http://patchwork.ozlabs.org/patch/683732/.

Thomas

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