Package: rhash
Version: 1.2.8-2
Severity: normal
Tags: upstream patch
User: debian-...@lists.debian.org
Usertags: ld-as-needed

rhash fails to build when --as-needed linker option is enabled,
because of incorrect order of parameters passed to ld. As a result,
librhash-jni.so was underlinked and tests failed.
Here's a log of failed build in Ubuntu:
https://launchpad.net/ubuntu/+source/rhash/1.2.8-2/+build/3003545/+files/buildlog_ubuntu-precise-i386.rhash_1.2.8-2_FAILEDTOBUILD.txt.gz

See also
http://wiki.debian.org/ToolChain/DSOLinking#Only_link_with_needed_libraries
http://wiki.mandriva.com/en/Underlinking

Patch from Ubuntu attached.
https://launchpad.net/ubuntu/+source/rhash/1.2.8-2ubuntu1

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

Kernel: Linux 3.0.0-15-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: fix FTBFS with --as-needed linker option
 Libraries should be placed after object files in the linker call.
Author: Ilya Barygin <randomact...@ubuntu.com>

--- rhash-1.2.8.orig/bindings/java/native/Makefile
+++ rhash-1.2.8/bindings/java/native/Makefile
@@ -20,7 +20,8 @@
 CFLAGS = -g -O2
 LIBRHASH_INC =
 LIBRHASH_LD  =
-LDFLAGS = -lrhash $(LIBRHASH_LD)
+LDFLAGS = $(LIBRHASH_LD)
+LDLIBS = -lrhash
 ALLCFLAGS = $(CFLAGS) $(LIBRHASH_INC) -fPIC
 
 #Platform dependent
@@ -40,7 +41,7 @@
        $(CC) $(ALLCFLAGS) -c $< -o $@
 
 $(LIBRARY): $(OBJECTS)
-       $(CC) $(LDFLAGS) -shared -o $@ $(OBJECTS)
+       $(CC) $(LDFLAGS) -shared -o $@ $(OBJECTS) $(LDLIBS)
 
 clean:
        rm -f *.o $(LIBRARY)

Reply via email to