Source: libdeflate Version: 1.7-1 Tags: patch User: debian-cr...@lists.debian.org Usertags: ftcbfs
libdeflate fails to cross build from source for two reasons. First of all, it does not pass any cross tools to make and thus builds for the build architecture failing to find -lz, which is only installed for the host architecture. The easiest way to fix this is using dh_auto_build. A bigger issue is the use of profile guided optimization. This really is unsupportable in cross builds as the premise is that we cannot run the code. I propose automatically disabling pgo when performing a cross build. The results will not be the same as native builds, but at least, you get a working package. Please consider applying the attached patch. Helmut
diff --minimal -Nru libdeflate-1.7/debian/changelog libdeflate-1.7/debian/changelog --- libdeflate-1.7/debian/changelog 2021-01-03 14:36:39.000000000 +0100 +++ libdeflate-1.7/debian/changelog 2021-06-16 12:51:19.000000000 +0200 @@ -1,3 +1,12 @@ +libdeflate (1.7-1.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Fix FTCBFS: (Closes: #-1) + + Let dh_auto_build pass cross tools to make. + + Automatically skip pgo when DEB_BUILD_PROFILES contains cross. + + -- Helmut Grohne <hel...@subdivi.de> Wed, 16 Jun 2021 12:51:19 +0200 + libdeflate (1.7-1) unstable; urgency=medium * New upstream version diff --minimal -Nru libdeflate-1.7/debian/rules libdeflate-1.7/debian/rules --- libdeflate-1.7/debian/rules 2021-01-03 14:32:37.000000000 +0100 +++ libdeflate-1.7/debian/rules 2021-06-16 12:51:19.000000000 +0200 @@ -7,30 +7,34 @@ %: dh $@ +ifeq (,$(filter cross,$(DEB_BUILD_PROFILES))) +PROFILING_FLAG = -fprofile-use +else +PROFILING_FLAG = +endif override_dh_auto_build: - make CFLAGS="$(shell dpkg-buildflags --get CFLAGS) -fprofile-generate" \ +ifeq (,$(filter cross,$(DEB_BUILD_PROFILES))) + dh_auto_build -- CFLAGS="$(shell dpkg-buildflags --get CFLAGS) -fprofile-generate" \ LDFLAGS="$(shell dpkg-buildflags --get LDFLAGS) -fprofile-generate"\ CPPFLAGS="$(shell dpkg-buildflags --get CPPFLAGS)"\ - V=1 PREFIX=/usr DESTDIR=$(CURDIR)/debian/tmp -j$(shell nproc)\ - "INSTALL=install --strip-program=true"\ + V=1 PREFIX=/usr DESTDIR=$(CURDIR)/debian/tmp \ all test_programs for level in $(shell seq 1 12); do \ ./benchmark -$${level} ./lib/deflate_compress.c > /dev/null; \ done - make CFLAGS="$(shell dpkg-buildflags --get CFLAGS) -fprofile-use" \ - LDFLAGS="$(shell dpkg-buildflags --get LDFLAGS) -fprofile-use"\ +endif + dh_auto_build -- CFLAGS="$(shell dpkg-buildflags --get CFLAGS) $(PROFILING_FLAG)" \ + LDFLAGS="$(shell dpkg-buildflags --get LDFLAGS) $(PROFILING_FLAG)"\ CPPFLAGS="$(shell dpkg-buildflags --get CPPFLAGS)"\ - V=1 PREFIX=/usr DESTDIR=$(CURDIR)/debian/tmp -j$(shell nproc)\ - "INSTALL=install --strip-program=true"\ + V=1 PREFIX=/usr DESTDIR=$(CURDIR)/debian/tmp \ all test_programs override_dh_auto_install: - make CFLAGS="$(shell dpkg-buildflags --get CFLAGS) -fprofile-use" \ - LDFLAGS="$(shell dpkg-buildflags --get LDFLAGS) -fprofile-use"\ + dh_auto_build -- CFLAGS="$(shell dpkg-buildflags --get CFLAGS) $(PROFILING_FLAG)" \ + LDFLAGS="$(shell dpkg-buildflags --get LDFLAGS) $(PROFILING_FLAG)"\ CPPFLAGS="$(shell dpkg-buildflags --get CPPFLAGS)"\ - V=1 PREFIX=/usr DESTDIR=$(CURDIR)/debian/tmp -j$(shell nproc)\ - "INSTALL=install --strip-program=true"\ + V=1 PREFIX=/usr DESTDIR=$(CURDIR)/debian/tmp \ install override_dh_auto_test: