diff mbox

[1/1] avahi: link with libintl if libglib2 is enabled

Message ID 1476802403-5879-1-git-send-email-johan.oudinet@gmail.com
State Superseded
Headers show

Commit Message

Johan Oudinet Oct. 18, 2016, 2:53 p.m. UTC
Fix bug 9341: avahi-utils does not compile with uClibc and libglib2.

Signed-off-by: Johan Oudinet <johan.oudinet@gmail.com>
---
 package/avahi/avahi.mk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Thomas Petazzoni Oct. 18, 2016, 3:25 p.m. UTC | #1
Hello,

On Tue, 18 Oct 2016 16:53:23 +0200, Johan Oudinet wrote:

> diff --git a/package/avahi/avahi.mk b/package/avahi/avahi.mk
> index 069b45a..c9cf2bc 100644
> --- a/package/avahi/avahi.mk
> +++ b/package/avahi/avahi.mk
> @@ -168,7 +168,9 @@ endif
>  
>  AVAHI_CONF_ENV += CFLAGS="$(AVAHI_CFLAGS)"
>  
> -AVAHI_MAKE_OPTS += $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),LIBS=-lintl)
> +# If either locale or libglib2 is defined, avahi needs libintl.
> +AVAHI_MAKE_OPTS += \
> +	$(if $(BR2_NEEDS_GETTEXT_IF_LOCALE)$(BR2_PACKAGE_LIBGLIB2),LIBS=-lintl)

Hum, I wondering if it wouldn't be nicer to rely on the fact that the
Config.in of those packages enable BR2_PACKAGE_GETTEXT when necessary.
So maybe we should instead rely on BR2_PACKAGE_GETTEXT=y, with
something like:

ifeq ($(BR2_PACKAGE_GETTEXT),y)
AVAHI_DEPENDENCIES += gettext
AVAHI_MAKE_OPTS += LIBS=-lintl
endif

(and of course, remove the gettext dependency added conditionally on
BR2_NEEDS_GETTEXT_IF_LOCALE).

It would be necessary to also test this with musl and glibc
configurations, with gettext enabled, to make sure it doesn't break.

And if it works, then we should update the Buildroot manual, which has
a section on the gettext integration.

Thomas
Johan Oudinet Oct. 19, 2016, 12:42 p.m. UTC | #2
Hi Thomas,

On Tue, Oct 18, 2016 at 5:25 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
>
> On Tue, 18 Oct 2016 16:53:23 +0200, Johan Oudinet wrote:
>
>> diff --git a/package/avahi/avahi.mk b/package/avahi/avahi.mk
>> index 069b45a..c9cf2bc 100644
>> --- a/package/avahi/avahi.mk
>> +++ b/package/avahi/avahi.mk
>> @@ -168,7 +168,9 @@ endif
>>
>>  AVAHI_CONF_ENV += CFLAGS="$(AVAHI_CFLAGS)"
>>
>> -AVAHI_MAKE_OPTS += $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),LIBS=-lintl)
>> +# If either locale or libglib2 is defined, avahi needs libintl.
>> +AVAHI_MAKE_OPTS += \
>> +     $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE)$(BR2_PACKAGE_LIBGLIB2),LIBS=-lintl)
>
> Hum, I wondering if it wouldn't be nicer to rely on the fact that the
> Config.in of those packages enable BR2_PACKAGE_GETTEXT when necessary.
> So maybe we should instead rely on BR2_PACKAGE_GETTEXT=y, with
> something like:
>
> ifeq ($(BR2_PACKAGE_GETTEXT),y)
> AVAHI_DEPENDENCIES += gettext
> AVAHI_MAKE_OPTS += LIBS=-lintl
> endif
>
> (and of course, remove the gettext dependency added conditionally on
> BR2_NEEDS_GETTEXT_IF_LOCALE).
>
> It would be necessary to also test this with musl and glibc
> configurations, with gettext enabled, to make sure it doesn't break.
>
> And if it works, then we should update the Buildroot manual, which has
> a section on the gettext integration.
>

Good idea. I'm trying it and if it works, I'll send a patch serie. One
to modify the documentation, and one to update every packet that
integrates gettext.
Thomas Petazzoni Oct. 19, 2016, 12:59 p.m. UTC | #3
Hello,

On Wed, 19 Oct 2016 14:42:45 +0200, Johan Oudinet wrote:

> >> -AVAHI_MAKE_OPTS += $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),LIBS=-lintl)
> >> +# If either locale or libglib2 is defined, avahi needs libintl.
> >> +AVAHI_MAKE_OPTS += \
> >> +     $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE)$(BR2_PACKAGE_LIBGLIB2),LIBS=-lintl)  
> >
> > Hum, I wondering if it wouldn't be nicer to rely on the fact that the
> > Config.in of those packages enable BR2_PACKAGE_GETTEXT when necessary.
> > So maybe we should instead rely on BR2_PACKAGE_GETTEXT=y, with
> > something like:
> >
> > ifeq ($(BR2_PACKAGE_GETTEXT),y)
> > AVAHI_DEPENDENCIES += gettext
> > AVAHI_MAKE_OPTS += LIBS=-lintl
> > endif
> >
> > (and of course, remove the gettext dependency added conditionally on
> > BR2_NEEDS_GETTEXT_IF_LOCALE).
> >
> > It would be necessary to also test this with musl and glibc
> > configurations, with gettext enabled, to make sure it doesn't break.
> >
> > And if it works, then we should update the Buildroot manual, which has
> > a section on the gettext integration.
> 
> Good idea. I'm trying it and if it works, I'll send a patch serie. One
> to modify the documentation, and one to update every packet that
> integrates gettext.

Could you please send the documentation patch alone first, so we can
validate the approach (i.e not only me, but also other folks in
Buildroot), before you spend time on reworking all the packages. This
way, we can all agree on the new approach first.

Thanks a lot!

Thomas
Johan Oudinet Oct. 19, 2016, 4:23 p.m. UTC | #4
On Wed, Oct 19, 2016 at 2:59 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> On Wed, 19 Oct 2016 14:42:45 +0200, Johan Oudinet wrote:
>
>> >> -AVAHI_MAKE_OPTS += $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),LIBS=-lintl)
>> >> +# If either locale or libglib2 is defined, avahi needs libintl.
>> >> +AVAHI_MAKE_OPTS += \
>> >> +     $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE)$(BR2_PACKAGE_LIBGLIB2),LIBS=-lintl)
>> >
>> > Hum, I wondering if it wouldn't be nicer to rely on the fact that the
>> > Config.in of those packages enable BR2_PACKAGE_GETTEXT when necessary.
>> > So maybe we should instead rely on BR2_PACKAGE_GETTEXT=y, with
>> > something like:
>> >
>> > ifeq ($(BR2_PACKAGE_GETTEXT),y)
>> > AVAHI_DEPENDENCIES += gettext
>> > AVAHI_MAKE_OPTS += LIBS=-lintl
>> > endif
>> >
>> > (and of course, remove the gettext dependency added conditionally on
>> > BR2_NEEDS_GETTEXT_IF_LOCALE).
>> >
>> > It would be necessary to also test this with musl and glibc
>> > configurations, with gettext enabled, to make sure it doesn't break.
>> >
>> > And if it works, then we should update the Buildroot manual, which has
>> > a section on the gettext integration.
>>
>> Good idea. I'm trying it and if it works, I'll send a patch serie. One
>> to modify the documentation, and one to update every packet that
>> integrates gettext.
>
> Could you please send the documentation patch alone first, so we can
> validate the approach (i.e not only me, but also other folks in
> Buildroot), before you spend time on reworking all the packages. This
> way, we can all agree on the new approach first.
>

Sure. However, It does break if I activate gettext with glibc:
----------8<----------8<----------8<----------8<----------8<----------
>>> avahi 0.6.32 Building
PATH="/home/johan/Documents/buildroot/output-glibc/host/bin:/home/johan/Documents/buildroot/output-glibc/host/sbin:/home/johan/Documents/buildroot/output-glibc/host/usr/bin:/home/johan/Documents/buildroot/output-glibc/host/usr/sbin:/home/johan/cov-analysis-linux64-6.6.1/bin:/home/johan/bin:/home/johan/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
 /usr/bin/make -j9 LIBS=-lintl -C
/home/johan/Documents/buildroot/output-glibc/build/avahi-0.6.32/
/usr/bin/make  all-recursive
Making all in common
make[4]: Nothing to be done for 'all'.
Making all in avahi-common
/bin/bash ../libtool  --tag=CC   --mode=link
/home/johan/Documents/buildroot/output-glibc/host/usr/bin/i686-pc-linux-gnu-gcc
-std=gnu99 -I.. '-DDEBUG_TRAP=__asm__("int $3")' -pthread
-DAVAHI_LOCALEDIR=\"/usr/share/locale\" -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os  -DDISABLE_SYSTEMD
-std=c99 -Wall -W -Wextra -pedantic -pipe -Wformat
-Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal
-Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes
-Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels
-Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align
-Wwrite-strings -fdiagnostics-show-option -Wno-cast-qual
-fno-strict-aliasing   -version-info 8:3:5  -o libavahi-common.la
-rpath /usr/lib libavahi_common_la-malloc.lo
libavahi_common_la-address.lo libavahi_common_la-alternative.lo
libavahi_common_la-error.lo libavahi_common_la-strlst.lo
libavahi_common_la-domain.lo libavahi_common_la-timeval.lo
libavahi_common_la-simple-watch.lo libavahi_common_la-thread-watch.lo
libavahi_common_la-rlist.lo libavahi_common_la-utf8.lo
libavahi_common_la-i18n.lo  -pthread   -lintl
libtool: link: /home/johan/Documents/buildroot/output-glibc/host/usr/bin/i686-pc-linux-gnu-gcc
-std=gnu99 -shared  -fPIC -DPIC  .libs/libavahi_common_la-malloc.o
.libs/libavahi_common_la-address.o
.libs/libavahi_common_la-alternative.o
.libs/libavahi_common_la-error.o .libs/libavahi_common_la-strlst.o
.libs/libavahi_common_la-domain.o .libs/libavahi_common_la-timeval.o
.libs/libavahi_common_la-simple-watch.o
.libs/libavahi_common_la-thread-watch.o
.libs/libavahi_common_la-rlist.o .libs/libavahi_common_la-utf8.o
.libs/libavahi_common_la-i18n.o   -lintl  -pthread -Os -pthread
-pthread -Wl,-soname -Wl,libavahi-common.so.3 -o
.libs/libavahi-common.so.3.5.3
/home/johan/Documents/buildroot/output-glibc/host/opt/ext-toolchain/bin/../lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../i686-pc-linux-gnu/bin/ld:
cannot find -lintl
----------8<----------8<----------8<----------8<----------8<----------

However, if I don't manually select the gettext package, it won't be
selected and the build is a success. I'm not sure when it makes sense
to manually select gettext?
Arnout Vandecappelle Oct. 19, 2016, 4:27 p.m. UTC | #5
On 19-10-16 18:23, Johan Oudinet wrote:
> On Wed, Oct 19, 2016 at 2:59 PM, Thomas Petazzoni
> <thomas.petazzoni@free-electrons.com> wrote:
>> > On Wed, 19 Oct 2016 14:42:45 +0200, Johan Oudinet wrote:
>> >
>>>>> >> >> -AVAHI_MAKE_OPTS += $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),LIBS=-lintl)
>>>>> >> >> +# If either locale or libglib2 is defined, avahi needs libintl.
>>>>> >> >> +AVAHI_MAKE_OPTS += \
>>>>> >> >> +     $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE)$(BR2_PACKAGE_LIBGLIB2),LIBS=-lintl)
>>>> >> >
>>>> >> > Hum, I wondering if it wouldn't be nicer to rely on the fact that the
>>>> >> > Config.in of those packages enable BR2_PACKAGE_GETTEXT when necessary.
>>>> >> > So maybe we should instead rely on BR2_PACKAGE_GETTEXT=y, with
>>>> >> > something like:
>>>> >> >
>>>> >> > ifeq ($(BR2_PACKAGE_GETTEXT),y)
>>>> >> > AVAHI_DEPENDENCIES += gettext
>>>> >> > AVAHI_MAKE_OPTS += LIBS=-lintl
>>>> >> > endif
>>>> >> >
>>>> >> > (and of course, remove the gettext dependency added conditionally on
>>>> >> > BR2_NEEDS_GETTEXT_IF_LOCALE).
>>>> >> >
>>>> >> > It would be necessary to also test this with musl and glibc
>>>> >> > configurations, with gettext enabled, to make sure it doesn't break.
>>>> >> >
>>>> >> > And if it works, then we should update the Buildroot manual, which has
>>>> >> > a section on the gettext integration.
>>> >>
>>> >> Good idea. I'm trying it and if it works, I'll send a patch serie. One
>>> >> to modify the documentation, and one to update every packet that
>>> >> integrates gettext.
>> >
>> > Could you please send the documentation patch alone first, so we can
>> > validate the approach (i.e not only me, but also other folks in
>> > Buildroot), before you spend time on reworking all the packages. This
>> > way, we can all agree on the new approach first.
>> >
> Sure. However, It does break if I activate gettext with glibc:

 That was exactly my concern with Thomas's proposal...

 I would say: don't touch this now, and schedule it for discussion at the next
BR developer meeting.

 Regards,
 Arnout
Waldemar Brodkorb Oct. 19, 2016, 5:25 p.m. UTC | #6
Hi,
Arnout Vandecappelle wrote,

> On 19-10-16 18:23, Johan Oudinet wrote:
> > On Wed, Oct 19, 2016 at 2:59 PM, Thomas Petazzoni
> > <thomas.petazzoni@free-electrons.com> wrote:
> >> > On Wed, 19 Oct 2016 14:42:45 +0200, Johan Oudinet wrote:
> >> >
> >>>>> >> >> -AVAHI_MAKE_OPTS += $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),LIBS=-lintl)
> >>>>> >> >> +# If either locale or libglib2 is defined, avahi needs libintl.
> >>>>> >> >> +AVAHI_MAKE_OPTS += \
> >>>>> >> >> +     $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE)$(BR2_PACKAGE_LIBGLIB2),LIBS=-lintl)
> >>>> >> >
> >>>> >> > Hum, I wondering if it wouldn't be nicer to rely on the fact that the
> >>>> >> > Config.in of those packages enable BR2_PACKAGE_GETTEXT when necessary.
> >>>> >> > So maybe we should instead rely on BR2_PACKAGE_GETTEXT=y, with
> >>>> >> > something like:
> >>>> >> >
> >>>> >> > ifeq ($(BR2_PACKAGE_GETTEXT),y)
> >>>> >> > AVAHI_DEPENDENCIES += gettext
> >>>> >> > AVAHI_MAKE_OPTS += LIBS=-lintl
> >>>> >> > endif
> >>>> >> >
> >>>> >> > (and of course, remove the gettext dependency added conditionally on
> >>>> >> > BR2_NEEDS_GETTEXT_IF_LOCALE).
> >>>> >> >
> >>>> >> > It would be necessary to also test this with musl and glibc
> >>>> >> > configurations, with gettext enabled, to make sure it doesn't break.
> >>>> >> >
> >>>> >> > And if it works, then we should update the Buildroot manual, which has
> >>>> >> > a section on the gettext integration.
> >>> >>
> >>> >> Good idea. I'm trying it and if it works, I'll send a patch serie. One
> >>> >> to modify the documentation, and one to update every packet that
> >>> >> integrates gettext.
> >> >
> >> > Could you please send the documentation patch alone first, so we can
> >> > validate the approach (i.e not only me, but also other folks in
> >> > Buildroot), before you spend time on reworking all the packages. This
> >> > way, we can all agree on the new approach first.
> >> >
> > Sure. However, It does break if I activate gettext with glibc:
> 
>  That was exactly my concern with Thomas's proposal...
> 
>  I would say: don't touch this now, and schedule it for discussion at the next
> BR developer meeting.

Just want to mention that I want integrate gettext-tiny into
uClibc-ng soon. It is a stub implementation. The existing stub isn't
selectable since a while...

https://github.com/rofl0r/gettext-tiny

best regards
 Waldemar
Thomas Petazzoni Oct. 19, 2016, 7:55 p.m. UTC | #7
Hello,

On Wed, 19 Oct 2016 18:27:29 +0200, Arnout Vandecappelle wrote:

> > Sure. However, It does break if I activate gettext with glibc:  
> 
>  That was exactly my concern with Thomas's proposal...

Yes, I also thought about it.

>  I would say: don't touch this now, and schedule it for discussion at the next
> BR developer meeting.

I don't think we can do that: there is a real build failure today if we
don't make a fix.

Best regards,

Thomas
Thomas Petazzoni Oct. 19, 2016, 7:57 p.m. UTC | #8
Hello,

On Wed, 19 Oct 2016 19:25:50 +0200, Waldemar Brodkorb wrote:

> Just want to mention that I want integrate gettext-tiny into
> uClibc-ng soon. It is a stub implementation. The existing stub isn't
> selectable since a while...
> 
> https://github.com/rofl0r/gettext-tiny

Interesting. I once started experimenting a bit with integrating
gettext-tiny in Buildroot, but it was not that easy to achieve.

In fact, the problem with gettext is two-fold: it's both the target
gettext (i.e libintl) but also the host gettext (for gettext tools)
that are annoyingly long to build.

Thomas
Arnout Vandecappelle Oct. 20, 2016, 8:25 a.m. UTC | #9
On 19-10-16 21:55, Thomas Petazzoni wrote:
> Hello,
> 
> On Wed, 19 Oct 2016 18:27:29 +0200, Arnout Vandecappelle wrote:
> 
>>  I would say: don't touch this now, and schedule it for discussion at the next
>> BR developer meeting.
> 
> I don't think we can do that: there is a real build failure today if we
> don't make a fix.

 With "don't touch this" I meant: apply this patch the way it is now (using our
traditional approach of adding -lintl), and delay reworking the whole thing
until FOSDEM.

 Regards,
 Arnout
Bernd Kuhls June 10, 2017, 7:32 p.m. UTC | #10
Am Tue, 18 Oct 2016 16:53:23 +0200 schrieb Johan Oudinet:

> Fix bug 9341: avahi-utils does not compile with uClibc and libglib2.

Hi,

please test this patch: http://patchwork.ozlabs.org/patch/774259/
It should not fail with glibc.

Regards, Bernd
diff mbox

Patch

diff --git a/package/avahi/avahi.mk b/package/avahi/avahi.mk
index 069b45a..c9cf2bc 100644
--- a/package/avahi/avahi.mk
+++ b/package/avahi/avahi.mk
@@ -168,7 +168,9 @@  endif
 
 AVAHI_CONF_ENV += CFLAGS="$(AVAHI_CFLAGS)"
 
-AVAHI_MAKE_OPTS += $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),LIBS=-lintl)
+# If either locale or libglib2 is defined, avahi needs libintl.
+AVAHI_MAKE_OPTS += \
+	$(if $(BR2_NEEDS_GETTEXT_IF_LOCALE)$(BR2_PACKAGE_LIBGLIB2),LIBS=-lintl)
 
 define AVAHI_USERS
 	avahi -1 avahi -1 * - - -