[Pkg-running-devel] Bug#810415: Bug#810415: Bug#810415: Bug#810415: garmin-plugin: please switch to libusb 1.0

Olaf Meeuwissen paddy-hack at member.fsf.org
Sun Feb 14 07:55:16 UTC 2016

Hi Aurelien,

Aurelien Jarno writes:

> On 2016-02-13 19:33, Olaf Meeuwissen wrote:
>> Hi Christian,
>> Christian PERRIER writes:
>> > Quoting Aurelien Jarno (aurel32 at debian.org):
>> >> Package: garmin-plugin
>> >> Version: 0.3.23-1
>> >> Severity: wishlist
>> >> 
>> >> Dear Maintainer,
>> >> 
>> >> garmin-plugin has a build-depends on libusb-dev. A few years ago upstream
>> >> has released a new major version libusb 1.0 with a different API which
>> >> aims to fix design deficiencies with USB 2.0 and 3.0 in mind.
>> >> 
>> >> The old libusb 0.1 package is not supported upstream anymore and should
>> >> be considered deprecated.
>> >> 
>> >> If garmin-plugin supports the new libusb 1.0 library, please consider
>> >> switching the build-depends from libusb-dev to libusb-1.0-0-dev. If not
>> >> please inform upstream that porting the software to the new API is
>> >> recommended.
>> >
>> >
>> > Here also, a simple attempt to rebuild bychanging the build dependency
>> > also failed, which was more or less expected....
>> I cloned Debian's git packaging repository for garmin-plugin and had a
>> look at what it might take to get things fixed.  Thing is, I cannot find
>> any code dependency on libusb.  That is, there is no code that calls any
>> USB API.  Unless code is pulled in during the build, the only thing that
>> "requires" libusb is the check at configure time.
> That is indeed correct. This is even confirmed by the following output
> of dpkg-shlibdeps during the build:
> dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/garmin-plugin/usr/lib/mozilla/plugins/npGarminPlugin.so was not linked against libusb-0.1.so.4 (it uses none of the library's symbols)

These warnings can be somewhat misleading at times.  The plugin might be
linked to another library that uses libusb symbols and expects its users
to make sure that libusb is linked to.

I saw that yesterday compiling garmin-forerunner-tools, where all the
programs link to libusb because libgarmintools doesn't.  That is a bug
of course but I'm not going to fix that.

>> The README documents a rather cumbersome build procedure that involves
>> compiling garmintools as well.  I can imagine that that needs libusb.
>> Maybe that inspired the documented "need" for a libusb dependency?
>> As the debian/rules file simply builds below src/ without any of the
>> hoopla from the README, I thought you can just drop the libusb check
>> from the configure script and be done with it.
> That's the correct way to do it.
>> Tried that and quickly found out that the garmin.h header file from
>> garmin-forerunner-tools includes usb.h.  The only other package that
>> depends on garmin-forerunner-tools is libgarmin-dev.  Checked that
>> package's source and, unsurprisingly, their is zero mention of usb.
>> Moreover, it does not need garmin.h.
> If garmin-forerunner-tools includes <usb.h>, it should depends on
> libusb-dev, and garmin-pluging should therefore not need to include it.
> Of course that means the overall build still needs the old libusb 0.1,
> but that's one step forward in the right direction.

Why didn't I think of that?

It is of course very questionable to have garmin-forerunner-tools depend
on a -dev package but that is not garmin-plugin's problem.  And now that
garmin-forerunner-tools builds against libusb-1.0-0-dev, that should fix
the libusb-0.1 issue completely.

>> That means that splitting the USB stuff out of garmin.h would make it
>> possible to drop the libusb dependency on garmin-plugin.
>> However, that's more work than I'm willing to put in (now).
>> Hope this helps anyway,
> Thanks for looking at that, it definitely helps to see better what can
> be done.

I've attaced a two part fix for this.

The first part adds a "run-time" dependency to garmin-forerunner-tools
on libusb-1.0-0-dev.

The second part makes the build dependency on garmin-forerunner-tools
versioned to required 0.10repacked-7, assuming that is the version with
the libusb-1.0-0-dev Depends:.  In addition, it bumps the libusb check
in configure to require libusb-1.0.  This is needed because the build
still requires libusb related CFLAGS to find the header files.

# Things would be a lot easier if there was a proper libgarmintools-dev
# package.  I'd also rename libgarmin to something like libgarmin-image
# to make its scope clearer.  Hmm, maybe I should file wishlist bugs.

The changes below src/ are handled via patches with dh-autoreconf.  This
requires dh-autoreconf 11 and a debian/compat of 10.
I've simulated a test of the build on today's sid.  Went fine.

Hope this helps,
Olaf Meeuwissen, LPIC-2            FSF Associate Member since 2004-01-27
 GnuPG key: F84A2DD9/B3C0 2F47 EA19 64F4 9F13  F43E B8A4 A88A F84A 2DD9
 Support Free Software                        https://my.fsf.org/donate
 Join the Free Software Foundation              https://my.fsf.org/join
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-dependency-on-libusb-1.0-0-dev.patch
Type: text/x-diff
Size: 924 bytes
Desc: patch for garmin-forerunner-tools
URL: <http://lists.alioth.debian.org/pipermail/pkg-running-devel/attachments/20160214/afa86c0d/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Build-using-libusb-1.0.-Fixes-810415.patch
Type: text/x-diff
Size: 2702 bytes
Desc: patch for garmin-plugin
URL: <http://lists.alioth.debian.org/pipermail/pkg-running-devel/attachments/20160214/afa86c0d/attachment-0001.patch>

More information about the Pkg-running-devel mailing list