[avahi] Crosscompiling Avahi onto a uClinux system

Grant Erickson gerickson at nuovations.com
Sat Feb 9 01:06:24 PST 2008


Anthony,

Regrettably, the solution I suggested previously, while it successfully
builds, introduces some undesirable runtime problems.

As I mentioned previously, if Avahi's libtool finds a '*.la' file for either
the libdaemon or expat library, it uses the value of 'libdir=<dir>' it finds
therein.

If '--prefix=/usr' for either libdaemon or expat, then this 'libdir' value
is '/usr/lib'. Libtool then translates '-lexpat' (or '-ldaemon') on the link
line to '/usr/lib/libexpat.so' (or '/usr/lib/libdaemon.so').

In a cross-compilation environment, this is likely to be neither the right
architecture nor the right version of the library to link against. In short,
we lose at build time.

As I suggested in the prior e-mail, we could also handle this by removing
DESTDIR and setting the prefix to $(resultdir). This, indeed, fixes the
build-time problem. However, it results in libtool hard-coding $(resultdir)
as the RPATH in the linked executable which is NOT what we want either. We
lose again, but this time at run time.

It turns out that by REMOVING the '*.la' file for both expat and libdaemon,
we win at both build- and run-time by ensuring neither a misdirected link
nor an incorrect RPATH.

So, once again, configure libdaemon and expat like:

    cd $(objdir) && \
    $(srcdir)/configure \
    CC=$(CC) AR=$(AR) RANLIB=$(RANLIB) STRIP=$(STRIP) \
    --build=$(build) \
    --host=$(host) \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var

Build libdaemon and expat like:

    unset MAKEFLAGS && \
    $(MAKE) -C $(objdir) all

Stage/install libdaemon and expat like:

    unset MAKEFLAGS && \
    $(MAKE) -C $(objdir) DESTDIR=$(resultdir) install
    $(RM) $(RMFLAGS) $(resultdir)/usr/lib/*.la

Configure avahi like:

    cd $(objdir) && \
    $(srcdir)/configure \
    CC=$(CC) AR=$(AR) RANLIB=$(RANLIB) STRIP=$(STRIP) \
    CPPFLAGS="-I$(ResultDirectory)../expat/usr/include \
    -I$(ResultDirectory)../libcap/usr/include" \
    LDFLAGS="-L$(ResultDirectory)../expat/usr/lib \
    -L$(ResultDirectory)../libcap/lib" \
    LIBDAEMON_CFLAGS="-I$(resultdir)../libdaemon/usr/include " \
    LIBDAEMON_LIBS="-L$(resultdir)../libdaemon/usr/lib -ldaemon" \
    --build=$(build) \
    --host=$(host) \
    --disable-dbus \
    --disable-gdbm \
    --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

Regards,

Grant
Principal
Nuovation System Designs, LLC




More information about the avahi mailing list