Source: libhdf4 Version: 4.3.0-1 Tags: patch User: debian-cr...@lists.debian.org Usertags: ftcbfs
libhdf4 fails to cross build from source, because its gfortran build dependency is not satisfiable. In general, bare toolchain dependencies are not compatible with cross compilation, because they do not indicate the architecture they are used for. In this case, gfortran-for-host should be used. Note that gfortran-for-host does not provide a bare gfortran. For using it, it must be invoked as ${DEB_HOST_GNU_TYPE}-gfortran. All other alternatives regress some other use case. Hence I propose letting dpkg's buildtools.mk initialize F77. With these changes, we may run configure, but that fails detecting whether szip provides an encoder. It invokes SZ_encoder_enabled() and this is not something we can do during cross compilation. Recent versions always have encoder support, so I suggest guessing this during cross builds. With that additional change, configure passes, but make still fails. It runs ncgen during build for ctest0 and ftest0. Both are check programs not needed in a nocheck build, but the upstream build system insists building them. For one thing, mfhdf/ncgen/Makefile.am adds them to noinst_PROGRAMS (which it likely should not do). For another config/conclude.am explicitly adds $(chk_TESTS) to all-local so even then check_PROGRAMS are built with the all target. I tried removing them from the nocheck build, but I did not find a good way to achieve that. Thus leaving this aspect unaddressed for the moment. Let me know if you have good ideas. I note that the patch is meant for forky, not trixie. And then even if you leave the ncgen aspect unaddressed, please close this bug when addressing the Build-Dependency. Helmut
diff --minimal -Nru libhdf4-4.3.0/debian/changelog libhdf4-4.3.0/debian/changelog --- libhdf4-4.3.0/debian/changelog 2024-04-09 20:42:32.000000000 +0200 +++ libhdf4-4.3.0/debian/changelog 2025-05-31 17:49:16.000000000 +0200 @@ -1,3 +1,10 @@ +libhdf4 (4.3.0-1.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Improve cross building: Use gfortran-for-host. (Closes: #-1) + + -- Helmut Grohne <hel...@subdivi.de> Sat, 31 May 2025 17:49:16 +0200 + libhdf4 (4.3.0-1) unstable; urgency=medium * Team upload. diff --minimal -Nru libhdf4-4.3.0/debian/control libhdf4-4.3.0/debian/control --- libhdf4-4.3.0/debian/control 2024-04-09 20:42:13.000000000 +0200 +++ libhdf4-4.3.0/debian/control 2025-05-31 17:47:51.000000000 +0200 @@ -8,7 +8,7 @@ chrpath, debhelper-compat (= 13), flex, - gfortran, + gfortran-for-host, libaec-dev, libjpeg-dev, libtirpc-dev, diff --minimal -Nru libhdf4-4.3.0/debian/patches/cross.patch libhdf4-4.3.0/debian/patches/cross.patch --- libhdf4-4.3.0/debian/patches/cross.patch 1970-01-01 01:00:00.000000000 +0100 +++ libhdf4-4.3.0/debian/patches/cross.patch 2025-05-31 17:49:16.000000000 +0200 @@ -0,0 +1,26 @@ +--- libhdf4-4.3.0.orig/configure.ac ++++ libhdf4-4.3.0/configure.ac +@@ -845,15 +845,16 @@ + else + exit(1); + } +- ]])],[CAN_ENCODE="yes"],[CAN_ENCODE="no"],[]) +- +- ## Report szip encoder test results +- if test "X$CAN_ENCODE" = "Xyes"; then ++ ]])],[ + AC_MSG_RESULT([yes]) +- fi +- if test "X$CAN_ENCODE" = "Xno"; then ++ CAN_ENCODE="yes" ++ ],[ + AC_MSG_RESULT([no]) +- fi ++ CAN_ENCODE="no" ++ ],[ ++ AC_MSG_RESULT([cross compiling. guessing yes]) ++ CAN_ENCODE="yes" ++ ]) + + ## Add "szip" to external filter list + if test "X$CAN_ENCODE" = "Xyes"; then diff --minimal -Nru libhdf4-4.3.0/debian/patches/series libhdf4-4.3.0/debian/patches/series --- libhdf4-4.3.0/debian/patches/series 2024-04-09 20:42:02.000000000 +0200 +++ libhdf4-4.3.0/debian/patches/series 2025-05-31 17:49:16.000000000 +0200 @@ -1,3 +1,4 @@ enablesharedfortran.diff reproducible-builds.patch szlib.patch +cross.patch diff --minimal -Nru libhdf4-4.3.0/debian/rules libhdf4-4.3.0/debian/rules --- libhdf4-4.3.0/debian/rules 2024-04-09 20:42:02.000000000 +0200 +++ libhdf4-4.3.0/debian/rules 2025-05-31 17:49:16.000000000 +0200 @@ -9,12 +9,11 @@ export DEB_BUILD_MAINT_OPTIONS=hardening=+all include /usr/share/dpkg/architecture.mk +include /usr/share/dpkg/buildtools.mk include /usr/share/dpkg/pkg-info.mk UPSTREAM_VERSION = $(shell echo $(DEB_VERSION_UPSTREAM) | sed -e 's/\+.*//') -DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH) - RELEASE := $(UPSTREAM_VERSION) PACKAGE := libhdf4 SOVER := 0 @@ -22,9 +21,6 @@ DESTDIR := $(CURDIR)/debian/tmp DESTDIR_ALT := $(CURDIR)/debian/tmp-alt -F77 := gfortran -CC := gcc -CXX := g++ LIBS := -ljpeg -lz -lm export DEB_FFLAGS_MAINT_APPEND += -fallow-argument-mismatch