Ticket #194 (new defect)

Opened 10 months ago

Last modified 10 months ago

libavahi-common needs to link libintl

Reported by: dmacks Assigned to: lennart
Priority: major Milestone:
Component: avahi-common Version:
Keywords: Cc:

Description

Compiling avahi-0.6.22 with --disable-glib --disable-gobject leads to a linker failure.

/bin/sh ../libtool --tag=CC --mode=link gcc -I.. '-DDEBUG_TRAP=asm("int $3")' -DAVAHI_DAEMON_RUNTIME_DIR=\"/sw/var/run/avahi-daemon/\" -DAVAHI_SOCKET=\"/sw/var/run/avahi-daemon/socket\" -DAVAHI_SERVICE_DIR=\"/sw/etc/avahi/services\" -DAVAHI_CONFIG_FILE=\"/sw/etc/avahi/avahi-daemon.conf\" -DAVAHI_HOSTS_FILE=\"/sw/etc/avahi/hosts\" -DAVAHI_DBUS_INTROSPECTION_DIR=\"/sw/share/avahi/introspection\" -DAVAHI_CONFIG_DIR=\"/sw/etc/avahi\" -g -O2 -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 -Winline -fPIC -DEXTENSIONS -L/sw/lib -o avahi-daemon avahi_daemon-main.o avahi_daemon-simple-protocol.o avahi_daemon-static-services.o avahi_daemon-static-hosts.o avahi_daemon-ini-file-parser.o avahi_daemon-setproctitle.o avahi_daemon-check-nss.o avahi_daemon-dbus-protocol.o avahi_daemon-dbus-util.o avahi_daemon-dbus-async-address-resolver.o avahi_daemon-dbus-async-host-name-resolver.o avahi_daemon-dbus-async-service-resolver.o avahi_daemon-dbus-domain-browser.o avahi_daemon-dbus-entry-group.o avahi_daemon-dbus-service-browser.o avahi_daemon-dbus-service-type-browser.o avahi_daemon-dbus-sync-address-resolver.o avahi_daemon-dbus-sync-host-name-resolver.o avahi_daemon-dbus-sync-service-resolver.o avahi_daemon-dbus-record-browser.o avahi_daemon-dbus.o avahi_daemon-dbus-watch-glue.o ../avahi-common/libavahi-common.la ../avahi-core/libavahi-core.la -L/sw/lib -ldaemon -lexpat -ldl -L/sw/lib -ldbus-1 mkdir .libs gcc -I.. "-DDEBUG_TRAP=asm(\"int \$3\")" -DAVAHI_DAEMON_RUNTIME_DIR=\"/sw/var/run/avahi-daemon/\" -DAVAHI_SOCKET=\"/sw/var/run/avahi-daemon/socket\" -DAVAHI_SERVICE_DIR=\"/sw/etc/avahi/services\" -DAVAHI_CONFIG_FILE=\"/sw/etc/avahi/avahi-daemon.conf\" -DAVAHI_HOSTS_FILE=\"/sw/etc/avahi/hosts\" -DAVAHI_DBUS_INTROSPECTION_DIR=\"/sw/share/avahi/introspection\" -DAVAHI_CONFIG_DIR=\"/sw/etc/avahi\" -g -O2 -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 -Winline -fPIC -DEXTENSIONS -o .libs/avahi-daemon avahi_daemon-main.o avahi_daemon-simple-protocol.o avahi_daemon-static-services.o avahi_daemon-static-hosts.o avahi_daemon-ini-file-parser.o avahi_daemon-setproctitle.o avahi_daemon-check-nss.o avahi_daemon-dbus-protocol.o avahi_daemon-dbus-util.o avahi_daemon-dbus-async-address-resolver.o avahi_daemon-dbus-async-host-name-resolver.o avahi_daemon-dbus-async-service-resolver.o avahi_daemon-dbus-domain-browser.o avahi_daemon-dbus-entry-group.o avahi_daemon-dbus-service-browser.o avahi_daemon-dbus-service-type-browser.o avahi_daemon-dbus-sync-address-resolver.o avahi_daemon-dbus-sync-host-name-resolver.o avahi_daemon-dbus-sync-service-resolver.o avahi_daemon-dbus-record-browser.o avahi_daemon-dbus.o avahi_daemon-dbus-watch-glue.o -L/sw/lib ../avahi-common/.libs/libavahi-common.dylib ../avahi-core/.libs/libavahi-core.dylib /sw/build.build/avahi-0.6.22-1/avahi-0.6.22/avahi-common/.libs/libavahi-common.dylib /sw/lib/libdaemon.dylib /sw/lib/libexpat.dylib -ldl /sw/lib/libdbus-1.dylib /usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: Undefined symbols: _libintl_dgettext _libintl_bind_textdomain_codeset _libintl_bindtextdomain collect2: ld returned 1 exit status make[2]: *** [avahi-daemon] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2

Looks like the library uses libintl but does not link against it. Configure does set some flags for libintl:

checking for GNU gettext in libintl... yes checking whether to use NLS... yes checking where the gettext function comes from... external libintl checking how to link with libintl... -lintl -liconv -lc -Wl,-framework -Wl,CoreFoundation?

but then those flags are not propagated. The solution is to adjust avahi-common/Makefile.am so that the (correctly-determined) libintl linker flags are used:

-libavahi_common_la_LIBADD = $(AM_LDADD) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) +libavahi_common_la_LIBADD = $(AM_LDADD) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(LIBINTL)

This allows the lib to compile fully for me. so that the libintl linker flags are passed.

Change History

01/21/08 21:30:01 changed by dmacks

The error-message is a bit misleading here on account of dynamic-linking: the symbol is actually called from libavahi-common (i18n.c) so that's the lib that should link libintl, but there's no symptom until something else links against libavahi-common and tries to resolve all symbols.