I think the -lhdf5 is not the issue here. Using pkg-config to discover
the library likely is more porttable, but it shouldn't change the
picture here. I'd expect it to exhibit the same error as an unmodified
build. A quick peek inidicates that the failure mode is different (it
skips an incompatible -lhdf5 and gives up). It is unclear to me why it
actually proceeds linking here.
Anyway, the real issue is the gcc invocation. It's the build
architecture compiler. Please use $(CC) here. It'll be supplied by
dh_auto_build. You don't have to assign CC anywhere as make defaults it
to "cc".
diff --git a/debian/patches/cross.patch b/debian/patches/cross.patch new file mode 100644 index 0000000..af022e8 --- /dev/null +++ b/debian/patches/cross.patch @@ -0,0 +1,32 @@ +--- a/Makefile ++++ b/Makefile +@@ -1,3 +1,4 @@ ++PKG_CONFIG ?= pkg-config + CFLAGS = -O3 -Wall -Wextra -fno-strict-aliasing + MACHINE_ARCH := $(shell echo `uname -m`) + +@@ -5,19 +6,19 @@ + + dextract: dextract.c DB.c DB.h QV.c QV.h + #gcc $(CFLAGS) -I/usr/include/hdf5/serial/ -L/usr/lib/${MACHINE_ARCH}-linux-gnu/hdf5/serial/ -o dextract dextract.c DB.c QV.c -lhdf5 +- gcc $(CFLAGS) $(ARGS) -o dextract dextract.c DB.c QV.c -lhdf5 ++ $(CC) $(ARGS) $(CFLAGS) -o dextract dextract.c DB.c QV.c `$(PKG_CONFIG) --libs hdf5` + + dexta: dexta.c DB.c DB.h QV.c QV.h +- gcc $(CFLAGS) -o dexta dexta.c DB.c QV.c ++ $(CC) $(CFLAGS) -o dexta dexta.c DB.c QV.c + + undexta: undexta.c DB.c DB.h QV.c QV.h +- gcc $(CFLAGS) -o undexta undexta.c DB.c QV.c ++ $(CC) $(CFLAGS) -o undexta undexta.c DB.c QV.c + + dexqv: dexqv.c DB.c DB.h QV.c QV.h +- gcc $(CFLAGS) -o dexqv dexqv.c DB.c QV.c ++ $(CC) $(CFLAGS) -o dexqv dexqv.c DB.c QV.c + + undexqv: undexqv.c DB.c DB.h QV.c QV.h +- gcc $(CFLAGS) -o undexqv undexqv.c DB.c QV.c ++ $(CC) $(CFLAGS) -o undexqv undexqv.c DB.c QV.c + + clean: + rm -f dextract dexta undexta dexqv undexqv dextract.tar.gz diff --git a/debian/patches/series b/debian/patches/series index 0c590ad..e449290 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,2 @@ use_system_packaged_libhdf5-dev.patch +cross.patch diff --git a/debian/rules b/debian/rules index 59f4a0e..10b546f 100755 --- a/debian/rules +++ b/debian/rules @@ -12,7 +12,7 @@ include /usr/share/dpkg/default.mk override_dh_auto_build: ifneq ($(wildcard /usr/lib/$(DEB_HOST_MULTIARCH)/hdf5/serial/libhdf5.so),) - $(MAKE) all ARGS="-I/usr/include/hdf5/serial -L/usr/lib/$(DEB_HOST_MULTIARCH)/hdf5/serial" + dh_auto_build -- ARGS="-I/usr/include/hdf5/serial" endif override_dh_auto_clean: