Bug 9341

Summary: avahi-utils does not compile with uClibc + libglib2
Product: buildroot Reporter: Johan Oudinet <johan.oudinet>
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: buildroot
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:
Attachments: rpi2_avahi_dbus_libglib2_defconfig
Add libintl if libglib2 is enabled

Description Johan Oudinet 2016-10-10 15:34:19 UTC
Created attachment 6746 [details]
rpi2_avahi_dbus_libglib2_defconfig

When compiling the avahi package in both buildroot 2016.08 and master (from Today), I get the following error message:
------8<------8<------8<------8<------8<------8<------
Making all in avahi-utils
  CC       avahi_browse-avahi-browse.o
  CC       avahi_browse-sigint.o
  CC       avahi_resolve-avahi-resolve.o
  CC       avahi_resolve-sigint.o
  CC       avahi_publish-avahi-publish.o
  CC       avahi_set_host_name-avahi-set-host-name.o
  CC       avahi_publish-sigint.o
  CC       avahi_set_host_name-sigint.o
  CCLD     avahi-set-host-name
  CCLD     avahi-resolve
  CCLD     avahi-publish
  CCLD     avahi-browse
/home/johan/Documents/buildroot/output/host/usr/lib/gcc/arm-buildroot-linux-uclibcgnueabihf/5.4.0/../../../../arm-buildroot-linux-uclibcgnueabihf/bin/ld: avahi_set_host_name-avahi-set-host-name.o: undefined reference to symbol 'libintl_dgettext'
/home/johan/Documents/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabihf/sysroot/usr/lib/libintl.so.8: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:632: recipe for target 'avahi-set-host-name' failed
------8<------8<------8<------8<------8<------8<------

To reproduce this bug, start from the defconfig for RPI 2 (raspberrypi2_defconfig), then select dbus, libglib2, avahi, and avahi-daemon (or use the attached defconfig).

Note, a workaround is to also select BR2_TOOLCHAIN_BUILDROOT_LOCALE. So, avahi.mk adds libintl since BR2_NEEDS_GETTEXT_IF_LOCALE is defined.

I don't know how to solve this issue properly.
Comment 1 Johan Oudinet 2016-10-11 09:42:50 UTC
Created attachment 6751 [details]
Add libintl if libglib2 is enabled

I may have a solution (see attached patch).
It does fix the compilation error in my case but I'm not sure it doesn't compile with libintl too often.
Comment 2 Thomas Petazzoni 2017-07-15 09:33:58 UTC
I believe this issue has been resolved by the recent gettext reworked, merged in master since early July. Now, all 3 C libraries have a gettext implementation built-in, which allows to avoid a lot of those issues.