Source: libhdf4 Version: 4.3.1-2 Tags: patch User: [email protected] Usertags: ftcbfs
libhdf4 fails to cross build from source for multiple reasons. When not building for armhf, the failure is selecting a build architecture compiler. This is due to the upstream build system using its own compiler detection rather than relying on the one provided by autoconf. I am aware that you mentioned switching to CMake, but it seems like exporting suitable CC+CXX would still be a worthwhile change in the mean time. You can drop that once switching to CMake. When it comes to armhf, the use of gcc-14 is implemented in a way breaking cross builds. Toolchain build dependencies should be annotated with -for-build or -for-host (depending on what is appropriate). The conditional in debian/rules branches on the build architecture when it should be branching on the host architecture and the assigned compilers fail to account for the triplet. All of these changes apply beyond the switch to CMake. Once fixing these, the next build failure arises from running the built ncgen. I am not familiar with this tool, but it ends up getting installed into hdf4-tools, which is marked as Multi-Arch: foreign. This suggests that we should likely be using the installed version for cross builds only. Do you concur here? In any case, I think we should defer the surgery about ncgen until after the migration to CMake has proceeded. This bug report is not meant to cover the ncgen aspect. Helmut
diff -Nru libhdf4-4.3.1/debian/changelog libhdf4-4.3.1/debian/changelog --- libhdf4-4.3.1/debian/changelog 2025-11-28 10:31:02.000000000 +0100 +++ libhdf4-4.3.1/debian/changelog 2025-11-29 13:05:43.000000000 +0100 @@ -1,3 +1,13 @@ +libhdf4 (4.3.1-2.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Improve cross building. (Closes: #-1) + + Build depend on -for-host variants of the toolchain. + + Fix build vs host confusion. + + Always export CC and CXX as the upstream build system wrongly guesses it. + + -- Helmut Grohne <[email protected]> Sat, 29 Nov 2025 13:05:43 +0100 + libhdf4 (4.3.1-2) unstable; urgency=medium * Team upload. diff -Nru libhdf4-4.3.1/debian/control libhdf4-4.3.1/debian/control --- libhdf4-4.3.1/debian/control 2025-11-28 10:30:24.000000000 +0100 +++ libhdf4-4.3.1/debian/control 2025-11-29 13:01:26.000000000 +0100 @@ -8,8 +8,8 @@ chrpath, debhelper-compat (= 13), flex, - gcc-14 [armhf], - g++-14 [armhf], + gcc-14-for-host [armhf], + g++-14-for-host [armhf], libaec-dev, libjpeg-dev, libtirpc-dev, diff -Nru libhdf4-4.3.1/debian/rules libhdf4-4.3.1/debian/rules --- libhdf4-4.3.1/debian/rules 2025-11-28 10:30:12.000000000 +0100 +++ libhdf4-4.3.1/debian/rules 2025-11-29 13:05:30.000000000 +0100 @@ -13,16 +13,19 @@ UPSTREAM_VERSION = $(shell echo $(DEB_VERSION_UPSTREAM) | sed -e 's/\+.*//') -DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH) - export DEB_CPPFLAGS_MAINT_APPEND = -I/usr/include/tirpc/ export DEB_LDFLAGS_MAINT_APPEND = -ltirpc -ifneq (,$(filter $(DEB_BUILD_ARCH),armhf)) -export CC=gcc-14 -export CXX=g++-14 +ifneq (,$(filter $(DEB_HOST_ARCH),armhf)) +CC=$(DEB_HOST_GNU_TYPE)-gcc-14 +CXX=$(DEB_HOST_GNU_TYPE)-g++-14 endif +# The upstream buildsystem defaults to CC=gcc in cross builds. +include /usr/share/dpkg/buildtools.mk +export CC +export CXX + ifneq (,$(findstring verbose,$(DEB_BUILD_OPTIONS))) DH_VERBOSE=1 export DH_VERBOSE

