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