Bug#792851: FTCBFS: confuses build arch and host arch compiler
Helmut Grohne
helmut at subdivi.de
Sun Jul 19 11:22:27 UTC 2015
Source: cyrus-sasl2
Version: 2.1.26.dfsg1-12
Tags: patch
User: helmutg at debian.org
Usertags: rebootstrap
Dear cyrus-sasl2 maintainers,
I noticed that cyrus-sasl2 fails to crossbuild from source. It uses the
wrong compiler in various places. Let me summarize:
* The makemd5 tool is executed during build, but not installed into any
binary package. Thus it needs to be built with the build arch
compiler, but the upstream source currently selects the host arch
compiler.
* The upstream source adds -ldb as a Makefile prerequisite. Thereby, it
accidentally exploits an area of make where architecture awareness is
exhibited: Make searches for -ldb in using its build(!) arch search
path. Since -ldb is only requested for the host architecture, that
search fails. The proposed solution here is to remove -ldb from the
make dependencies while still linking it.
* The Debian packaging builds a sample server and client and uses the
build arch compiler. Thus linking fails, because no build arch
version of -lsasl2 can be found. The solution is to use the host arch
compiler here as those binaries are installed into binary packages.
All of these these fixes can be found in the cumulative patch attached
to this bug report. Please consider applying it. If you have questions
about the proposed fixes or identified issues, don't hesitate to ask.
Helmut
-------------- next part --------------
diff -Nru cyrus-sasl2-2.1.26.dfsg1/debian/changelog cyrus-sasl2-2.1.26.dfsg1/debian/changelog
--- cyrus-sasl2-2.1.26.dfsg1/debian/changelog
+++ cyrus-sasl2-2.1.26.dfsg1/debian/changelog
@@ -1,3 +1,10 @@
+cyrus-sasl2 (2.1.26.dfsg1-12.1) UNRELEASED; urgency=low
+
+ * Non-maintainer upload.
+ * Fix cross build. (Closes: #-1)
+
+ -- Helmut Grohne <helmut at subdivi.de> Fri, 27 Feb 2015 20:02:52 +0100
+
cyrus-sasl2 (2.1.26.dfsg1-12) unstable; urgency=medium
* Add patch to fix login to dovecot imapd 2.x (Closes: #715040)
diff -Nru cyrus-sasl2-2.1.26.dfsg1/debian/patches/cross.patch cyrus-sasl2-2.1.26.dfsg1/debian/patches/cross.patch
--- cyrus-sasl2-2.1.26.dfsg1/debian/patches/cross.patch
+++ cyrus-sasl2-2.1.26.dfsg1/debian/patches/cross.patch
@@ -0,0 +1,37 @@
+Description: fix cross compialtion
+Author: Helmut Grohne <helmut at subdivi.de>
+
+ * makemd5 needs to be built with the build arch compiler, because it is run
+ during build and not installed.
+ * Remove SASL_DB_LIB as it expands to -ldb and make fails to find a build arch
+ -ldb.
+
+Index: cyrus-sasl2-2.1.26.dfsg1/include/Makefile.am
+===================================================================
+--- cyrus-sasl2-2.1.26.dfsg1.orig/include/Makefile.am
++++ cyrus-sasl2-2.1.26.dfsg1/include/Makefile.am
+@@ -51,6 +51,11 @@
+
+ makemd5_SOURCES = makemd5.c
+
++$(makemd5_OBJECTS): CC=cc
++$(makemd5_OBJECTS): CFLAGS=$(CFLAGS_FOR_BUILD)
++$(makemd5_OBJECTS): CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
++makemd5_LINK = cc -o $@
++
+ md5global.h: makemd5
+ -rm -f md5global.h
+ ./makemd5 md5global.h
+Index: cyrus-sasl2-2.1.26.dfsg1/sasldb/Makefile.am
+===================================================================
+--- cyrus-sasl2-2.1.26.dfsg1.orig/sasldb/Makefile.am
++++ cyrus-sasl2-2.1.26.dfsg1/sasldb/Makefile.am
+@@ -55,7 +55,7 @@
+
+ libsasldb_la_SOURCES = allockey.c sasldb.h
+ EXTRA_libsasldb_la_SOURCES = $(extra_common_sources)
+-libsasldb_la_DEPENDENCIES = $(SASL_DB_BACKEND) $(SASL_DB_LIB)
++libsasldb_la_DEPENDENCIES = $(SASL_DB_BACKEND)
+ libsasldb_la_LIBADD = $(SASL_DB_BACKEND) $(SASL_DB_LIB)
+
+ # Prevent make dist stupidity
diff -Nru cyrus-sasl2-2.1.26.dfsg1/debian/patches/series cyrus-sasl2-2.1.26.dfsg1/debian/patches/series
--- cyrus-sasl2-2.1.26.dfsg1/debian/patches/series
+++ cyrus-sasl2-2.1.26.dfsg1/debian/patches/series
@@ -31,3 +31,4 @@
properly-create-libsasl2.pc.patch
bug715040.patch
early-hangup.patch
+cross.patch
diff -Nru cyrus-sasl2-2.1.26.dfsg1/debian/rules cyrus-sasl2-2.1.26.dfsg1/debian/rules
--- cyrus-sasl2-2.1.26.dfsg1/debian/rules
+++ cyrus-sasl2-2.1.26.dfsg1/debian/rules
@@ -25,6 +25,10 @@
include /usr/share/dpkg/buildflags.mk
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+ifeq ($(origin CC),default)
+export CC=$(DEB_HOST_GNU_TYPE)-cc
+endif
# Save Berkeley DB used for building the package
BDB_VERSION ?= $(shell LC_ALL=C dpkg-query -l 'libdb[45].[0-9]-dev' | grep ^ii | sed -e 's|.*\s\libdb\([45]\.[0-9]\)-dev\s.*|\1|')
diff -Nru cyrus-sasl2-2.1.26.dfsg1/debian/sample/Makefile cyrus-sasl2-2.1.26.dfsg1/debian/sample/Makefile
--- cyrus-sasl2-2.1.26.dfsg1/debian/sample/Makefile
+++ cyrus-sasl2-2.1.26.dfsg1/debian/sample/Makefile
@@ -7,7 +7,7 @@
all: sample-server sample-client
sample-server: sample-server.c
- gcc -g -o sample-server sample-server.c -I. -I$(T) -I$(INCDIR1) -I$(INCDIR2) -L$(LIBDIR) -lsasl2
+ $(CC) -g -o sample-server sample-server.c -I. -I$(T) -I$(INCDIR1) -I$(INCDIR2) -L$(LIBDIR) -lsasl2
sample-client: sample-client.c
- gcc -g -o sample-client sample-client.c -I. -I$(T) -I$(INCDIR1) -I$(INCDIR2) -L$(LIBDIR) -lsasl2
+ $(CC) -g -o sample-client sample-client.c -I. -I$(T) -I$(INCDIR1) -I$(INCDIR2) -L$(LIBDIR) -lsasl2
More information about the Pkg-cyrus-sasl2-debian-devel
mailing list