Source: dovecot Version: 1:2.3.13+dfsg1-1 Tags: patch User: debian-cr...@lists.debian.org Usertags: ftcbfs X-Debbugs-Cc: Sam Hartman <hartm...@debian.org>
dovecot fails to cross build from source, because it fails linking -lkrb5: | libtool: compile: mips64el-linux-gnuabi64-gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/lib -I../../src/lib-auth -I../../src/lib-test -I../../src/lib-dict -I../../src/lib-dns -I../../src/lib-http -I../../src/lib-sql -I../../src/lib-settings -I../../src/lib-old-stats -I../../src/lib-otp -I../../src/lib-master -I../../src/lib-oauth2 -I../../src/lib-ssl-iostream -I../../src/lib-lua -I../../src/lib-dcrypt -DAUTH_MODULE_DIR=\"/usr/lib/dovecot/modules/auth\" -DPKG_LIBEXECDIR=\"/usr/lib/dovecot\" -DPKG_RUNDIR=\"/run/dovecot\" -DSYSCONFDIR=\"/etc/dovecot\" -I/usr/include/lua5.3 -isystem /usr/include/mit-krb5 -isystem /usr/include/mit-krb5 -DPLUGIN_BUILD -Wdate-time -D_FORTIFY_SOURCE=2 -std=gnu99 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast -fno-builtin-strftime -Wstrict-aliasing=2 -c mech-gssapi.c -fPIC -DPIC -o .libs/libmech_gssapi_la-mech-gssapi.o | /bin/bash ../../libtool --tag=CC --mode=link mips64el-linux-gnuabi64-gcc -std=gnu99 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast -fno-builtin-strftime -Wstrict-aliasing=2 -module -avoid-version -Wl,-z,relro -Wl,-z,now -rdynamic -o libmech_gssapi.la -rpath /usr/lib/dovecot/modules/auth libmech_gssapi_la-mech-gssapi.lo -L/usr/lib/x86_64-linux-gnu/mit-krb5 -Wl,-z,relro -lkrb5 -lk5crypto -lcom_err -L/usr/lib/x86_64-linux-gnu/mit-krb5 -Wl,-z,relro -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err | libtool: link: mips64el-linux-gnuabi64-gcc -shared -fPIC -DPIC .libs/libmech_gssapi_la-mech-gssapi.o -L/usr/lib/x86_64-linux-gnu/mit-krb5 -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -g -O2 -fstack-protector-strong -fstack-protector-strong -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,-z -Wl,relro -Wl,-z -Wl,relro -Wl,-soname -Wl,libmech_gssapi.so -o .libs/libmech_gssapi.so | /usr/lib/gcc-cross/mips64el-linux-gnuabi64/10/../../../../mips64el-linux-gnuabi64/bin/ld: cannot find -lgssapi_krb5 | /usr/lib/gcc-cross/mips64el-linux-gnuabi64/10/../../../../mips64el-linux-gnuabi64/bin/ld: cannot find -lkrb5 | /usr/lib/gcc-cross/mips64el-linux-gnuabi64/10/../../../../mips64el-linux-gnuabi64/bin/ld: cannot find -lk5crypto | collect2: error: ld returned 1 exit status | make[5]: *** [Makefile:1105: libmech_gssapi.la] Error 1 You may notice that it passes -L/usr/lib/x86_64-linux-gnu/mit-krb5, but that directory does not exist. This flag comes from krb5-config.mit. The krb5-config.mit script expects that you export a suitable CC during cross compilation. Failing that, it uses the native library path I think there are practically three different solutions to this problem: 1. Tell krb5-config.mit which CC to use via the environment. I'm attaching a patch for this solution. 2. Stop using krb5-config.mit and use pkg-config instead. This solution is not entirely trivial as the package name needs to be configurable. Once pkg-config is in use, the host architecture is passed without issues. We use a ${DEB_HOST_GNU_TYPE}-pkg-config, which looks up the architecture-specific .pc file and all is well. 3. krb5-config.mit should just know the right architecture. Given that this tool does not carry the host architecture anywhere, all it can do is use the package architecture. Doing so would remove the Multi-Arch: same flag. Once the flag is removed, krb5-config.mit can become architecture-dependent and all is well. I'm Ccing Sam to comment here. Unless you have a strong opinion, I propose going with the simple solution attached. Helmut
diff --minimal -Nru dovecot-2.3.13+dfsg1/debian/changelog dovecot-2.3.13+dfsg1/debian/changelog --- dovecot-2.3.13+dfsg1/debian/changelog 2021-01-26 00:38:17.000000000 +0100 +++ dovecot-2.3.13+dfsg1/debian/changelog 2021-03-01 17:26:09.000000000 +0100 @@ -1,3 +1,10 @@ +dovecot (1:2.3.13+dfsg1-1.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Fix FTCBFS: Tell krb5-config.mit which CC to use. (Closes: #-1) + + -- Helmut Grohne <hel...@subdivi.de> Mon, 01 Mar 2021 17:26:09 +0100 + dovecot (1:2.3.13+dfsg1-1) unstable; urgency=medium [ Christian Göttsche ] diff --minimal -Nru dovecot-2.3.13+dfsg1/debian/rules dovecot-2.3.13+dfsg1/debian/rules --- dovecot-2.3.13+dfsg1/debian/rules 2021-01-26 00:38:17.000000000 +0100 +++ dovecot-2.3.13+dfsg1/debian/rules 2021-03-01 17:26:09.000000000 +0100 @@ -16,6 +16,7 @@ # Ensure that stacktrace generation works: export DEB_LDFLAGS_MAINT_APPEND = -rdynamic include /usr/share/dpkg/architecture.mk +-include /usr/share/dpkg/buildtools.mk ifneq ($(filter armel armhf, $(DEB_HOST_ARCH)),) export DEB_CFLAGS_MAINT_APPEND = -funwind-tables endif @@ -93,7 +94,7 @@ dh_autoreconf debian/autogen.sh override_dh_auto_configure: - KRB5CONFIG=krb5-config.mit dh_auto_configure -- \ + CC='$(CC)' KRB5CONFIG=krb5-config.mit dh_auto_configure -- \ --with-ldap=plugin \ --with-ssl=openssl \ --with-sql=plugin \