Package: sendip
Version: 2.5-5
Severity: normal
Tags: upstream patch
User: [email protected]
Usertags: ld-as-needed

sendip fails to build when --as-needed linker option is enabled,
because of incorrect order of parameters passed to ld. Here's a log of
failed build in Ubuntu:
https://launchpadlibrarian.net/107190254/buildlog_ubuntu-quantal-i386.sendip_2.5-5_FAILEDTOBUILD.txt.gz

See also
http://wiki.debian.org/ToolChain/DSOLinking#Only_link_with_needed_libraries

The attached patch was used in Ubuntu to fix the problem.
https://launchpad.net/ubuntu/+source/sendip/2.5-5ubuntu1

-- System Information:
Debian Release: wheezy/sid
  APT prefers precise-updates
  APT policy: (500, 'precise-updates'), (500, 'precise-security'), (500, 
'precise-proposed'), (500, 'precise'), (100, 'precise-backports')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-25-generic (SMP w/2 CPU cores)
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Description: place libraries after object files in linker call
Author: Ilya Barygin <[email protected]>

--- sendip-2.5.orig/Makefile
+++ sendip-2.5/Makefile
@@ -16,8 +16,9 @@ CFLAGS += -fPIC -fsigned-char -pipe -Wal
 #-Wcast-align causes problems on solaris, but not serious ones
 #LDFLAGS=	-g -rdynamic -lm
 #LDFLAGS_SOLARIS= -g -lsocket -lnsl -lm
-LDFLAGS_SOLARIS= -g -lsocket -lnsl -lm -ldl
-LDFLAGS_LINUX = $(LDFLAGS) -ldl
+LDFLAGS_SOLARIS= -g
+LIBS_SOLARIS= -lsocket -lnsl -lm -ldl
+LIBS_LINUX= -ldl
 LIBCFLAGS= -shared $(LDFLAGS)
 CC=	gcc
 
@@ -34,9 +35,9 @@ all:	$(GLOBALOBJS) sendip $(PROTOS) send
 #there has to be a nice way to do this
 sendip:	sendip.o	gnugetopt.o gnugetopt1.o compact.o
 	sh -c "if [ `uname` = Linux -o `uname` = GNU/kFreeBSD -o `uname` = GNU ] ; then \
-$(CC) -o $@ $(LDFLAGS_LINUX) $(CFLAGS) $+ ; \
+$(CC) -o $@ $(LDFLAGS) $(CFLAGS) $+ $(LIBS_LINUX) ; \
 elif [ `uname` = SunOS ] ; then \
-$(CC) -o $@ $(LDFLAGS_SOLARIS) $(CFLAGS) $+ ;\
+$(CC) -o $@ $(LDFLAGS_SOLARIS) $(CFLAGS) $+ $(LIBS_SOLARIS) ;\
 else \
 $(CC) -o $@ $(LDFLAGS) $(CFLAGS) $+ ; \
 fi"

Reply via email to