Package: dnsprogs
Version: 2.57
Severity: wishlist
Tags: patch
User: [email protected]
Usertags: ld-as-needed


dnsprogs underlinks its public libaries when built with ld --as-needed.
With --as-needed objects must be before libraries providing their
undefined symbols. Else they will be dropped.
This causes problems in reverse dependencies linking to the libraries [0]

See the ubuntu buildlog for rdepend muroard failure:
https://launchpadlibrarian.net/83077507/buildlog_ubuntu-precise-i386.muroard_0.1.8-1_FAILEDTOBUILD.txt.gz

/usr/bin/gcc -Wl,-Bsymbolic-functions -Wl,-z,relro -Wall -Wextra -g -O2
 -o muroard muroard.o para.o network.o waveform.o proto.o dsp.o
clients.o streams.o memmgr.o cf_au.o cf_riff_wave.o driver.o main.o
-ldnet_daemon -ldnet -lao
/usr/lib/gcc/i686-linux-gnu/4.6/../../../../lib/libdnet_daemon.so:
undefined reference to `crypt'

See ldd -r for the missing links:
ldd -r ./libdap/libdnet-dap.so
undefined symbol: getnodebyname (./libdap/libdnet-dap.so)
undefined symbol: dnet_recv     (./libdap/libdnet-dap.so)

ldd -r libdaemon/libdnet_daemon.so.2.43.1
undefined symbol: dnet_htoa     (libdaemon/libdnet_daemon.so.2.43.1)
undefined symbol: crypt (libdaemon/libdnet_daemon.so.2.43.1)
undefined symbol: getobjectbyname       (libdaemon/libdnet_daemon.so.2.43.1)
undefined symbol: getnodebyname (libdaemon/libdnet_daemon.so.2.43.1)

Attached patch fixes the issue by reordering the commandline correctly.
Thanks for considering the patch.

[0] http://wiki.mandriva.com/en/Underlinking
Description: fix underlinking with ld --as-needed
 libraries must be after objects needing their symbols on the command line
Author: Julian Taylor <[email protected]>
--- dnprogs-2.57//libdaemon/Makefile    2011-02-18 15:22:29.000000000 +0100
+++ dnprogs-patched//libdaemon/Makefile 2011-10-23 15:29:47.062977795 +0200
@@ -18,7 +18,7 @@
        ar -rv $@ $^
 
 $(SHAREDLIB): $(PICOBJS)
-       $(CC) $(CFLAGS) -shared -o $@ -Wl,-soname=$(LIBNAME).so.$(MAJOR_VERSION) $(LIBCRYPT) -L../libdnet/ -ldnet $^
+       $(CC) $(CFLAGS) -shared -o $@ -Wl,-soname=$(LIBNAME).so.$(MAJOR_VERSION) -L../libdnet/ $^ $(LIBCRYPT) -ldnet
        ln -sf $(SHAREDLIB) $(LIBNAME).so.$(MAJOR_VERSION)
        ln -sf $(LIBNAME).so.$(MAJOR_VERSION) $(LIBNAME).so
 
diff -ur dnprogs-2.57//libdap/Makefile dnprogs-patched//libdap/Makefile
--- dnprogs-2.57//libdap/Makefile       2011-02-18 15:22:29.000000000 +0100
+++ dnprogs-patched//libdap/Makefile    2011-10-23 15:30:56.914976838 +0200
@@ -18,7 +18,7 @@
        ar -rv $@ $^
 
 $(SHAREDLIB): $(PICOBJS)
-       $(CXX) $(CXXFLAGS) -shared -o $@ -Wl,-soname=$(LIBNAME).so.$(MAJOR_VERSION) -L../libdnet/ -ldnet $^
+       $(CXX) $(CXXFLAGS) -shared -o $@ -Wl,-soname=$(LIBNAME).so.$(MAJOR_VERSION) -L../libdnet/ $^ -ldnet
        ln -sf $(SHAREDLIB) $(LIBNAME).so.$(MAJOR_VERSION)
        ln -sf $(LIBNAME).so.$(MAJOR_VERSION) $(LIBNAME).so

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to