On 2014-09-16 at 03:31:20 -0700, Graham Ollis wrote:
>
>
> On Tuesday, September 16, 2014 1:22:20 AM UTC-4, Zakariyya Mughal wrote:
>
> Because Alien::Base only looks for dynamic libraries, libs() for
> > Alien::UDUNITS2 is empty on Windows. My current solution is to override
> > the libs() method and provide a set of working flags. I would like this
> > to just be a temporary measure just to get a release to CPAN and have
> > Alien::Base v0.005's features tested on Windows.
>
>
> Can we change Alien::Base to look for .a and then fallback on .so?
>
>
> > It may be worth looking into the libtool .la file if it is available.
> > That has much of the same information that we want from pkg-config.
> >
>
> I don't think the .la file will be at all hard to parse. Interesting:
>
>
https://www.flameeyes.eu/autotools-mythbuster/libtool/lafiles.html
>
> It would be good to default to static where possible.
Yes to both for me (choose .a over .so and static over dynamic linking).
There seem to be more advantages to these than disadvantages. The only
time I would prefer dynamic linking is for using LD_PRELOAD and
debugging.
Perhaps we could use something like:
libs():
if( $ENV{PERL_ALIEN_FOO_LIBS} eq 'dynamic' ) {
return $self->_dynamic_libs_flags();
}
return $self->_static_libs_flags(); # default to static
_dynamic_libs_flags(): "-L/path/to/share/dynamic -lfoo" # link to libfoo.so
_static_libs_flags() : "-L/path/to/share/lib -lfoo" # link to libfoo.a
This way, when Foo::XS is installed, the user can control how they want
to link. All they need to know is that Foo::XS uses Alien::Foo. This
will be an option for power users that may need to debug Foo::XS and is
easier than going in and editing the Perl build script.
> > For handling the compilation step of the proposed change, we could use
> > Devel::CheckLib or ExtUtils::CChecker. With a couple of my Alien
> > packages, on mohawk's advice, I have been using Inline::C to test that
> > the install can actually be compiled and linked to Perl
> > (Alien::Leptonica and Alien::UDUNITS2 do this).
> >
>
> I really like the interface for ExtUtils::CChecker. The authors
> responsiveness to requests has been a little mixed. We can also use
> ExtUtils::CBuilder, which is in core 5.10+.
>
I was looking over the docs again and I saw alien_provides_cflags and
alien_provides_libs. These probably fit my need better for the case of a
missing pkg-config. I'll have to test it later.
If we also use the .la & .a files to find the flags, then a potential
class Alien::Base::Libtool or an updated alien_find_lib_paths() will
give me everything I need and I won't need to override libs().
Perhaps we need a cookbook to distill this information for Alien::
module authors in the form of Problem / Solution?
>
> > Finally, good news! I was able to get Alien::UDUNITS2 up to CPAN and I'm
> > waiting on reports from Windows. It works on my Windows 7 VM. I asked
> > mohawk to test it via IRC, but there appears to be an issue with
> > installing File::chdir. I believe this Windows box is having the same
> > issue: <
> >
http://www.cpantesters.org/cpan/report/d9c6d1e6-6c43-1014-a24e-3d198ac59954>.
> >
> >
>
> I haven't had trouble installing File::chdir on my Windows. One
> alternative is File::pushd, which does more or less the same thing with a
> different interface.
I haven't had any trouble with it either. I saw this issue that Joel
answered from 2 years ago: <
https://github.com/Perl5-Alien/Alien-Base/issues/19>
which led to a patch to Perl. Could that be the problem, mohawk? We may
need to put a minimum version of 3.40 on Cwd to get that patch (or get
File::chdir to do so (currently File::chdir has Cwd => 3.16))[+]
[*]: alien_provides_cflags option: <
https://metacpan.org/pod/distribution/Alien-Base/lib/Alien/Base/ModuleBuild/API.pod#alien_provides_cflags>
[+]: Changelog for Cwd that shows where the patch "Cwd::fast_abs_path's
untaint should allow for multiline directories (Joel Berger)" occurs:
<
https://github.com/tsee/PathTools/blob/c6edf1986ccc855834a5ca09d2b3aced8b0d3c35/Changes#L20>