[Pkg-electronics-devel] Bug#1126480: ponyprog FTCBFS: fails to detect a libusb-1.0 version

Helmut Grohne helmut at subdivi.de
Mon Jan 26 13:03:13 GMT 2026


Source: ponyprog
Version: 3.1.4+ds-2.2
Tags: patch
User: debian-cross at lists.debian.org
Usertags: ftcbfs

ponyprog fails to cross build from source, because its build system
fails to detect a suitable version of libusb-1.0. If you look into
cmake/FindLibUSB-1.0.cmake, you see that it entirely skips any detection
of LIBUSB_VERSION when cross compilation is in effect. It uses try_run
to determine the version, so there is reason to skip, but the end result
is that the version check in the toplevel CMakeLists.txt fails.

I am proposing a workaround in the attached patch. We may easily
discover the version from pkg-config on Debian. If we override the
LIBUSB_VERSION variable, ponyprog cross builds successfully. This is a
working solution without patching upstream.

Arguably, a better solution would be to improve
cmake/FindLibUSB-1.0.cmake. When the cross build fails, I can see

    PC_LIBUSB_VERSION:INTERNAL=1.0.29

in the CMakeCache.txt. So it did look up libusb-1.0 using pkg-config and
it did figure out the right modversion. How about changing
cmake/FindLibUSB-1.0.cmake to see whether PC_LIBUSB_VERSION is set and
skip its manual detection when that is the case? On Debian, pkg-config
will work and therefore cross builds would skip the try_run stuff. Would
that be an acceptable improvement upstream? Doing so would also help
other cross distributions such as Yocto or PtxDist.

In the mean time, the Debian-specific workaround can be used.

Helmut
-------------- next part --------------
diff -Nru ponyprog-3.1.4+ds/debian/changelog ponyprog-3.1.4+ds/debian/changelog
--- ponyprog-3.1.4+ds/debian/changelog	2025-12-19 19:56:16.000000000 +0100
+++ ponyprog-3.1.4+ds/debian/changelog	2026-01-25 22:00:18.000000000 +0100
@@ -1,3 +1,10 @@
+ponyprog (3.1.4+ds-2.3) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: Override libusb version detection. (Closes: #-1)
+
+ -- Helmut Grohne <helmut at subdivi.de>  Sun, 25 Jan 2026 22:00:18 +0100
+
 ponyprog (3.1.4+ds-2.2) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -Nru ponyprog-3.1.4+ds/debian/rules ponyprog-3.1.4+ds/debian/rules
--- ponyprog-3.1.4+ds/debian/rules	2024-05-15 15:05:15.000000000 +0200
+++ ponyprog-3.1.4+ds/debian/rules	2026-01-25 22:00:18.000000000 +0100
@@ -11,6 +11,7 @@
 
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 DPKG_EXPORT_BUILDFLAGS = 1
+include /usr/share/dpkg/buildtools.mk
 include /usr/share/dpkg/buildflags.mk
 CFLAGS+=$(CPPFLAGS)
 CXXFLAGS+=$(CPPFLAGS)
@@ -32,6 +33,11 @@
 	-DUSE_QT5=ON \
 	$(NULL)
 
+ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+# Detection of libusb-1.0 version is disabled during cross compilation.
+DEB_PONYPROG_CMAKE_OPTS += -DLIBUSB_VERSION=$(shell $(PKG_CONFIG) --modversion libusb-1.0)
+endif
+
 %:
 	dh $@
 


More information about the Pkg-electronics-devel mailing list