Package: mrbayes
Version: 3.2.1+dfsg-1
Severity: normal
Tags: upstream patch
User: debian-...@lists.debian.org
Usertags: ld-as-needed

mrbayes 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://launchpad.net/ubuntu/+source/mrbayes/3.2.1+dfsg-1/+build/3447662/+files/buildlog_ubuntu-quantal-i386.mrbayes_3.2.1%2Bdfsg-1_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/mrbayes/3.2.1+dfsg-1ubuntu1

Note that LIBS="-Wl,--as-needed" in debian/rules doesn't actually enable
this setting. That can be done with something like "export LDFLAGS +=
-Wl,--as-needed".
Description: fix FTBFS with --as-needed linker option
 This way, libraries will be added to ld call after object files.
Author: Ilya Barygin <randomact...@ubuntu.com>

--- mrbayes-3.2.1+dfsg.orig/src/Makefile.in
+++ mrbayes-3.2.1+dfsg/src/Makefile.in
@@ -2,7 +2,7 @@ srcdir    = @srcdir@
 RM        = rm
 CC        = @CC@
 CFLAGS    = @CFLAGS@ -DUSECONFIG_H
-LDFLAGS   = @LDFLAGS@ -lm
+LDLIBS    = @LDFLAGS@ -lm
 INSTALL   = @INSTALL@
 
 SRC       =  bayes.c command.c mbmath.c mcmc.c model.c plot.c sump.c sumt.c tree.c utils.c mbbeagle.c best.c

Reply via email to