optional dependencies
Zefram <zefram <at> fysh.org>
2007-09-06 08:27:30 GMT
I've run into a problem building a CPAN distribution using Module::Build,
in an interesting way that raises questions about optional dependencies.
Specifically, I'm installing Crypt-MySQL-0.04, which comes with
both a Build.PL that uses Module::Build and a Makefile.PL that uses
ExtUtils::MakeMaker. Building the EU::MM way works perfectly, and is
obviously what the author does himself. Building the M::B way works
except for an undeclared dependency.
Crypt-MySQL includes some C code in an XS source file. When M::B comes
to compile this, it wants to use ExtUtils::CBuilder. I've only just
started using M::B, and didn't have EU::CB installed. The Build.PL
script therefore emitted a warning, "Module::Build is not configured
with C_support". However, that warning is only human-readable,
not machine-readable. I was doing this install via the CPAN module.
CPAN went on to (I presume) request a prereq_report, but this report
doesn't say anything about EU::CB either. CPAN then attempted to
build Crypt-MySQL, and the build immediately failed because of the lack
of EU::CB.
So, we have a dependency problem: Crypt-MySQL's build process required a
certain feature of M::B (compiling XS); that feature depends on EU::CB;
but the dependency is not installed. C-MS is unaware of the dependency,
as it's only using the M::B interface, and M::B appears to be fully
installed. C-MS could declare the dependency itself, as build_requires
=> { ExtUtils::CBuilder => "0.15" }, and I've submitted a patch to the
author to do that. But this seems a dubious way to do things. Other than
in this possible dependency declaration, the C-MS distribution doesn't
know anything about EU::CB; that name is not mentioned anywhere in the
C-MS tarball. It uses EU::CB only indirectly.
(Continue reading)