Ticket #15 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

avahi 0.6.7 fails to compile on gentoo

Reported by: robinp Owned by: lennart
Milestone: Avahi 0.6.9 Component: component1
Keywords: gentoo nss dlopen dlclose Cc:

Description

Avahi 0.6.7 fails to compile on gentoo giving the resultant error:

avahi_daemon-check-nss.o: In function 'avahi_nss_support':
check-nss.c:(.text+0x1a): undefined reference to 'dlopen'
check-nss.c:(.text+0x2b): undefined reference to 'dlclose'
collect2: Id returned 1 exit status
make[2]: *** [avahi-daemon] Error 1
make[2]: leaving directory '/var/tmp/portage/avahi-0.6.7/work/avahi-0.6.7/avahi-daemon'
etc etc

I corrected this error by adding the -ldl flag:

# CFLAGS="-ldl" emerge avahi

Change History

Changed 6 years ago by chris

I got a similar error when compiling without dbus support in 0.6.8 (see full config options below).

avahi_daemon-check-nss.o(.text+0x20): In function `avahi_nss_support':
: undefined reference to `dlopen'
avahi_daemon-check-nss.o(.text+0x30): In function `avahi_nss_support':
: undefined reference to `dlclose'

I guess this is somehow due to avahi-client not being built when using this option.

./configure --disable-glib --disable-qt3 --disable-qt4 --disable-gtk --disable-gdbm --disable-python --disable-pygtk --disable-python-dbus --disable-mono --disable-monodoc --disable-doxygen-doc --disable-doxygen-dot --disable-doxygen-html --disable-manpages --disable-xmltoman --with-distro=none --prefix= --host=arm-linux --disable-manpages --disable-dbus;

Changed 6 years ago by lennart

  • owner changed from somebody to lennart
  • status changed from new to assigned

I don't understand why -ldl isn't added to $LIBS on gentoo.

avahi-daemon/Makefile.am contains this:

if HAVE_DLOPEN
avahi_daemon_LDADD += -ldl
endif

Apparently this doesn't get evaluated on Gentoo. The question is: why?

Please show me the contents of config.h and the exact gcc command line that is built for linking avahi-daemon!

Changed 6 years ago by lennart

Ok, i found the bug. The check for HAVE_DLOPEN is nested inside HAVE_DBUS. Hence: if you compile without DBUS support "-ldl" is not added to the linker args.

Changed 6 years ago by lennart

  • status changed from assigned to closed
  • resolution set to fixed

fixed in r1165

Changed 6 years ago by sebest

  • milestone set to Avahi 0.6.9
Note: See TracTickets for help on using tickets.