Bug 195866 - devel/avrdude: hidden dependency on libftdi
Summary: devel/avrdude: hidden dependency on libftdi
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Joerg Wunsch
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-11 00:25 UTC by Dmitry Marakasov
Modified: 2015-04-22 11:07 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (joerg)


Attachments
Patch (1009 bytes, patch)
2015-04-06 03:16 UTC, Dmitry Marakasov
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Marakasov freebsd_committer 2014-12-11 00:25:10 UTC
% pkg info | grep ftdi
libftdi-0.20_4                 Library (using libusb) to talk to FTDI chips
% ldd /usr/local/bin/avrdude
/usr/local/bin/avrdude:
	libusb.so.3 => /usr/lib/libusb.so.3 (0x800886000)
	libftdi.so.1 => /usr/local/lib/libftdi.so.1 (0x800a99000)
	libelf.so.1 => /usr/lib/libelf.so.1 (0x800ca0000)
	libthr.so.3 => /lib/libthr.so.3 (0x800eb5000)
	libm.so.5 => /lib/libm.so.5 (0x8010da000)
	libreadline.so.6 => /usr/local/lib/libreadline.so.6 (0x801302000)
	libncurses.so.8 => /lib/libncurses.so.8 (0x80154d000)
	libc.so.7 => /lib/libc.so.7 (0x80179a000)
% pkg info -d avrdude-6.1 
avrdude-6.1:
% sudo pkg delete -q libftdi-0.20_4 
% ldd /usr/local/bin/avrdude 
/usr/local/bin/avrdude:
	libusb.so.3 => /usr/lib/libusb.so.3 (0x800886000)
	libftdi.so.1 => not found (0)
	libelf.so.1 => /usr/lib/libelf.so.1 (0x800a99000)
	libthr.so.3 => /lib/libthr.so.3 (0x800cae000)
	libm.so.5 => /lib/libm.so.5 (0x800ed3000)
	libreadline.so.6 => /usr/local/lib/libreadline.so.6 (0x8010fb000)
	libncurses.so.8 => /lib/libncurses.so.8 (0x801346000)
	libc.so.7 => /lib/libc.so.7 (0x801593000)


this should be added to LIB_DEPENDS or (better, as it's obviously optional) implemented as an option.
Comment 1 Bugzilla Automation freebsd_committer 2014-12-11 00:25:10 UTC
Auto-assigned to maintainer joerg@FreeBSD.org
Comment 2 Joerg Wunsch freebsd_committer 2014-12-11 07:03:24 UTC
Adding it as an option is a good idea (for those who actually want FTDI
support), but even if the option is not checked, if libftdi is around at
compile-time, avrdude will pick it up there during the "configure" stage.
Comment 3 Dmitry Marakasov freebsd_committer 2014-12-11 09:37:25 UTC
Well that is obvious. Since you're avrdude developer I expect you to fix this upstream and add a --with/--enable option into configure. What's for the port, it's common to fix such broken configure scripts by breaking library detection when it's not needed. Such as

.if ! ${PORT_OPTIONS:MFTDI}
post-patch:
    @${REINPLACE_CMD} -e '/LIBS=/ s|-lftdi|&-do-not-detect|' ${WRKSRC}/configure
.endif
Comment 4 Joerg Wunsch freebsd_committer 2014-12-11 20:09:11 UTC
(In reply to Dmitry Marakasov from comment #3)
> Since you're avrdude developer I expect you to fix
> this upstream and add a --with/--enable option into configure.

Sorry, it's not a bug, it's a feature.

For mere users, I don't want to burden them with adding a bunch
of --enable options, but just get them what their environment
would be able to provide.  Obviously, they have to take care
to have the prerequisites for their desired configuration around,
but they'll have to do that anyway.

I've seen other tools to work similarly now, OpenOCD for example.
(They used to have several dozens of --enable options in the past.)

> .if ! ${PORT_OPTIONS:MFTDI}
> post-patch:
>     @${REINPLACE_CMD} -e '/LIBS=/ s|-lftdi|&-do-not-detect|'
> ${WRKSRC}/configure
> .endif

OK, I might consider that.
Comment 5 Dmitry Marakasov freebsd_committer 2014-12-11 22:08:03 UTC
> Sorry, it's not a bug, it's a feature.

It's clearly a bug, as it prevents predictable and consistent builds, and violates POLA. The impression that it's convenient is false: what users get is random set of features based on what libraries they happen to have installed. You may confidently expect your users to discovert, for example, that ftdi support is gone after avrdude is build on a new machine. Then they have to spend time researching on how to get it back, as it's not even mentioned in `configure --help'.

Evilness of automatic dependencies is widely recognized, see various packaging guides and especially

http://wiki.gentoo.org/wiki/Project:Quality_Assurance/Automagic_dependencies
http://lwn.net/Articles/277132/

If you don't want to `burden' users, just provide sensible defaults for the options.
Comment 6 Joerg Wunsch freebsd_committer 2014-12-11 23:09:04 UTC
(In reply to Dmitry Marakasov from comment #5)

> If you don't want to `burden' users, just provide sensible defaults for the
> options.

No such thing like "sensible defaults" that would apply to everyone.

We won't agree on this, so let's stop here.
Comment 7 Dmitry Marakasov freebsd_committer 2015-04-06 03:16:03 UTC
Created attachment 155221 [details]
Patch
Comment 8 commit-hook freebsd_committer 2015-04-22 11:07:11 UTC
A commit references this bug:

Author: amdmi3
Date: Wed Apr 22 11:06:19 UTC 2015
New revision: 384484
URL: https://svnweb.freebsd.org/changeset/ports/384484

Log:
  - Simplify MASTER_SITES
  - Add LICENSE_FILE
  - Fix hidden dependency and optionize libftdi support

  PR:		195866
  Approved by:	maintainer timeout (joerg, 4 months)

Changes:
  head/devel/avrdude/Makefile