[avahi] Crosscompiling Avahi onto a uClinux system

Grant Erickson gerickson at nuovations.com
Fri Feb 8 23:38:32 PST 2008


On 2/8/08 5:12 PM, Grant Erickson wrote:
> On 2/8/08 4:22 AM, Antony Barton wrote:
>> I'm a fairly inexperienced linux developer and i have been landed the task of
>> implementing zeroconf on our embedded linux 2.4 system to provide the name
>> translation service (so we can refer to each device - whose ip will
>> invariably 
>> be unknown - by name), no other functionality is required and i would ideally
>> like to omit for space considerations.
>>  
>> Has anyone done this or something similar, and can anyone suggest what
>> components of the avahi package would be necessary to achieve this? I have
>> investigated bonjour also, but have had difficulties cross compiling it and i
>> also get the impression that avahi is a more appropriate choice for a linux
>> based system.
>>  
>> Any help that anyone could provide would be greatly appreciated.
>>  
>> Many thanks,
>>  
>> Antony Barton
> 
> Anthony,
> 
> I have been using the following cross-compilation invocation, where CC, AR, et
> al are set to those for your cross-compilation toolchain. Set/replace objdir,
> srcdir and resultdir as appropriate for your build tree.
> 
>     cd $(objdir) && \
>     $(CURDIR)/$(srcdir)/configure \
>     CC=$(CC) AR=$(AR) RANLIB=$(RANLIB) STRIP=$(STRIP) \
>     CPPFLAGS="-I$(resultdir)../expat/usr/include \
>     -I$(resultdir)../gdbm/usr/include \
>     -I$(resultdir)../libcap/usr/include" \
>     LDFLAGS="-L$(resultdir)../expat/usr/lib \
>     -L$(resultdir)../gdbm/usr/lib \
>     -L$(resultdir)../libcap/usr/lib" \
>     LIBDAEMON_CFLAGS=-I$(resultdir)../libdaemon/usr/include \
>     LIBDAEMON_LIBS=-L$(resultdir)../libdaemon/usr/lib \
>     --build=$(build) \
>     --host=$(host) \
>     --disable-dbus \
>     --disable-glib \
>     --disable-gobject \
>     --disable-gtk \
>     --disable-manpages \
>     --disable-monodoc \
>     --disable-python \
>     --disable-qt3 \
>     --disable-qt4 \
>     --with-distro=none \
>     --with-xml=expat \
>     --prefix=/usr \
>     --sysconfdir=/etc \
>     --localstatedir=/var
> 
> Per Trent Lloyd's later response to you, it sounds like you can trim this down
> even further yet. That's good news, since the above invocation will run into
> problems sourcing the Expat library from the wrong place (picks up what's in
> /usr/lib rather than specified by LDFLAGS).

Anthony,

I have made a little more headway with this effort. For starters, you'll
need to apply the following patch, since the configure script assumes that
the '#defines' applied for a native build on i686 also apply to a
cross-compile HOSTED on i686:

---- 
diff -r -u -N avahi-0.6.22/configure avahi-0.6.22.N/configure
--- avahi-0.6.22/configure      2007-12-17 07:37:37.000000000 -0800
+++ avahi-0.6.22.N/configure    2008-02-08 22:45:12.000000000 -0800
@@ -23280,6 +23280,8 @@
 rm -f conftest*
 
 
+if test "$cross_compiling" != yes; then
+
 for ac_header in stdlib.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -23749,6 +23751,7 @@
 
 
 
+fi
 
 
 
---

That applied and with the following configure invocation, I can successfully
cross-compile the avahi-autoipd subcomponent:

    cd $(objdir) && \
    $(CURDIR)/$(srcdir)/configure \
    CC=$(CC) AR=$(AR) RANLIB=$(RANLIB) STRIP=$(STRIP) \
    LIBDAEMON_CFLAGS=-I$(resultdir)../libdaemon/usr/include \
    LIBDAEMON_LIBS=-L$(resultdir)../libdaemon/usr/lib \
    --build=$(build) \
    --host=$(host) \
    --disable-dbus \
    --disable-glib \
    --disable-gobject \
    --disable-gtk \
    --disable-manpages \
    --disable-monodoc \
    --disable-python \
    --disable-qt3 \
    --disable-qt4 \
    --enable-libdaemon \
    --with-distro=none \
    --with-xml=expat \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var

However, it appears you DO need either expat or bsdxml to compile the
avahi-daemon subcomponent.

Regards,

Grant




More information about the avahi mailing list