Package: bitlbee
Version: 3.0.3-1
Severity: wishlist
Tags: patch
User: [email protected]
Usertags: origin-ubuntu oneiric ubuntu-patch
Forwarded: http://bugs.bitlbee.org/bitlbee/ticket/786

the package bitlbee is incorrectly linked when build with ld --as-needed..
This is caused by the libraries being placed before objects needing
their symbols on the command line. The libraries are then not registered
as needed
See the log in the ubuntu bug:
https://bugs.launchpad.net/ubuntu/+source/bitlbee/+bug/879730

Also it is missing an explicit link against glib2 from which it uses
symbols.

Attached patch fixes this issue.
Description: fix linking with ld --as-needed
 libraries must be placed behind objects needing their symbols.
 Also link explicitly against the needed glib
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/bitlbee/+bug/879730
Bug: http://bugs.bitlbee.org/bitlbee/ticket/786
Author: Julian Taylor <[email protected]>
--- a/Makefile
+++ b/Makefile
@@ -138,7 +138,7 @@
 
 $(OTR_PI): %.so: $(SRCDIR)%.c
 	@echo '*' Building plugin $@
-	@$(CC) $(CFLAGS) $(OTRFLAGS) -fPIC -shared $(LDFLAGS) $< -o $@
+	@$(CC) $(CFLAGS) $(OTRFLAGS) -fPIC -shared $(LDFLAGS) $< -o $@ $(OTRLIBS)
 
 $(objects): %.o: $(SRCDIR)%.c
 	@echo '*' Compiling $<
@@ -148,7 +148,7 @@
 
 $(OUTFILE): $(objects) $(subdirs)
 	@echo '*' Linking $(OUTFILE)
-	@$(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LFLAGS) $(EFLAGS)
+	@$(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LFLAGS) $(EFLAGS) $(ELIBS)
 ifndef DEBUG
 	@echo '*' Stripping $(OUTFILE)
 	@-$(STRIP) $(OUTFILE)
--- a/configure
+++ b/configure
@@ -528,11 +528,13 @@
 	# BI == built-in
 	echo '#define OTR_BI' >> config.h
 	echo "EFLAGS+=-L${otrprefix}/lib -lotr" >> Makefile.settings
+	echo "ELIBS+=-lotr -lglib-2.0" >> Makefile.settings
 	echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings
 	echo 'OTR_BI=otr.o' >> Makefile.settings
 elif [ "$otr" = "plugin" ]; then
 	echo '#define OTR_PI' >> config.h
 	echo "OTRFLAGS=-L${otrprefix}/lib -lotr" >> Makefile.settings
+	echo "OTRLIBS=-lotr -lglib-2.0" >> Makefile.settings
 	echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings
 	echo 'OTR_PI=otr.so' >> Makefile.settings
 fi

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to