Source: spaln
Version: 3.0.2+dfsg-2
Tags: patch upstream
User: [email protected]
Usertags: ftcbfs

spaln fails to cross build from source, because lists -l flags for 
linking libraries in Makefile dependencies. Doing so invokes a behavior 
where make looks up the library using a built-in library search path. 
This path is architecture-dependent and is one reason for make not being 
Multi-Arch: foreign. In any case, make does not succeed at looking up 
e.g. -lz as it tries /usr/lib/${DEB_BUILD_MULTIARCH} but not 
/usr/lib/${DEB_HOST_MULTIARCH} where it would actually reside. 
Generally, listing such dependencies bears little benefit. I'm attaching 
a patch that splits out these flags from the CLIB, SLIB and ULIB 
variables into a LIBRARIES variable such that they can still be passed 
to the compiler but not listed as target dependencies. Once applying it 
spaln cross builds successfully. Please consider applying it and also 
forwarding it upstream as it benefits other cross compilation 
distributions such as Yocto or PtxDist.

Helmut
--- spaln-3.0.2+dfsg.orig/src/Makefile.in
+++ spaln-3.0.2+dfsg/src/Makefile.in
@@ -23,7 +23,8 @@
 PROG = $(PROG_B) $(PROG_A) $(PROG_F)
 
 STDH = stdtype.h
-CLIB = clib.a -lpthread -lm -lz
+LIBRARIES = -lpthread -lm -lz
+CLIB = clib.a
 SLIB = sblib.a $(CLIB)
 ULIB = ublib.a $(SLIB)
 
@@ -88,36 +89,36 @@
 	ls $(SRC) $(HDR)
 
 spaln:	spaln.cc blksrc.o $(SLIB)
-	$(CXX) -o $@ spaln.cc blksrc.o $(SLIB) $(ILIB) $(LDFLAGS)
+	$(CXX) -o $@ spaln.cc blksrc.o $(SLIB) $(ILIB) $(LIBRARIES) $(LDFLAGS)
 sortgrcd:	sortgrcd.cc $(SLIB)
-	$(CXX) -o $@ sortgrcd.cc $(SLIB) $(ILIB) $(LDFLAGS)
+	$(CXX) -o $@ sortgrcd.cc $(SLIB) $(ILIB) $(LIBRARIES) $(LDFLAGS)
 makdbs: makdbs.cc dbs.h seq.h bitpat.h $(SLIB)
-	$(CXX) -o $@ makdbs.cc $(SLIB) $(ILIB) $(LDFLAGS)
+	$(CXX) -o $@ makdbs.cc $(SLIB) $(ILIB) $(LIBRARIES) $(LDFLAGS)
 makmdm: makmdm.cc mdm.h $(CLIB)
-	$(CXX) -o $@ makmdm.cc $(CLIB) $(ILIB) $(LDFLAGS)
+	$(CXX) -o $@ makmdm.cc $(CLIB) $(ILIB) $(LIBRARIES) $(LDFLAGS)
 
 dvn:	dvn.cc autocomp.h $(ULIB)
-	$(CXX) -o $@ dvn.cc $(ULIB) $(ILIB)
+	$(CXX) -o $@ dvn.cc $(ULIB) $(ILIB) $(LIBRARIES)
 exinpot: exinpot.cc codepot.h utilseq.h eijunc.h $(SLIB)
-	$(CXX) -o $@ exinpot.cc $(SLIB) $(ILIB)
+	$(CXX) -o $@ exinpot.cc $(SLIB) $(ILIB) $(LIBRARIES)
 kmers: kmers.cc $(SLIB)
-	$(CXX) -o $@ kmers.cc $(SLIB) $(ILIB)
+	$(CXX) -o $@ kmers.cc $(SLIB) $(ILIB) $(LIBRARIES)
 npssm:	npssm.cc $(SLIB)
-	$(CXX) -o $@ npssm.cc $(SLIB) $(ILIB)
+	$(CXX) -o $@ npssm.cc $(SLIB) $(ILIB) $(LIBRARIES)
 rdn:	rdn.cc 	$(ULIB)
-	$(CXX) -o $@ rdn.cc $(ULIB) $(ILIB)
+	$(CXX) -o $@ rdn.cc $(ULIB) $(ILIB) $(LIBRARIES)
 utn:	utn.o $(ULIB)
-	$(CXX) -o $@ utn.o $(ULIB) $(ILIB)
+	$(CXX) -o $@ utn.o $(ULIB) $(ILIB) $(LIBRARIES)
 
 compild: compild.cc calcserv.h ildpdf.o $(CLIB)
-	$(CXX) -o compild compild.cc ildpdf.o $(CLIB) -lm -lgsl -lgslcblas
+	$(CXX) -o compild compild.cc ildpdf.o $(CLIB) $(LIBRARIES) -lm -lgsl -lgslcblas
 decompild: decompild.o ildpdf.o fitild.o $(CLIB)
-	$(CXX) -o decompild decompild.o ildpdf.o fitild.o $(CLIB) -lgsl -lgslcblas
+	$(CXX) -o decompild decompild.o ildpdf.o fitild.o $(CLIB) $(LIBRARIES) -lgsl -lgslcblas
 fitild: fitild.cc ildpdf.o $(CLIB)
-	$(CXX) -o $@  -DMAIN fitild.cc ildpdf.o $(CLIB) \
+	$(CXX) -o $@  -DMAIN fitild.cc ildpdf.o $(CLIB) $(LIBRARIES) \
 	-L/usr/local/lib -lm -lgsl -lgslcblas
 plotild: plotild.cc ildpdf.o $(CLIB)
-	$(CXX) -o plotild plotild.cc ildpdf.o $(CLIB) -lm -lgsl -lgslcblas
+	$(CXX) -o plotild plotild.cc ildpdf.o $(CLIB) $(LIBRARIES) -lm -lgsl -lgslcblas
 
 clib.o:		clib.cc		stdtype.h
 iolib.o:	iolib.cc	stdtype.h

Reply via email to