RFC: inverting @INC for perl5.{8,10}

Eric Hall opendarwin.org at darkart.com
Wed Apr 16 12:13:03 PDT 2008


	Macports perl installs use the default @INC [1], which
can lead to problems if a perl module requires a newer version
of a (perl) Core module than what shipped with that version of
perl.
	One example is MIME::Tools, which requires File::Temp
of 0.18 or greater (in 5.426, 5.425 requires File::Temp 0.17),
perl 5.8.8 ships with File::Temp 0.16.  Because this is a core
module, and @INC is set to look there (${prefix}/lib/perl/5.8.8)
before site_perl and vendor_perl, a macports installed File::Temp
isn't used unless specific changes are made to every file that
uses File::Temp.
	If we invert @INC so that vendor_perl and site_perl
come before the core module location, macports installed modules
will take precedence over core-installed modules, giving
macports better control over what is installed.  This is something
that FreeBSD ports does [2], so its not a new idea.

	I don't know what negative impacts this has (I can imagine
problems with core modules expecting to get an older version of
another modules, dunno if that's a real problem or not), and
I'd expect this would be exposed in FreeBSD if it is a real-world
problem.

	Anyone see any other problems with this idea, and/or
reasons we should not do this?


		-eric



[1] perl 5.8.8 @INC is currently (sub ${prefix} for MP's prefix):
  @INC:
    ${prefix}/lib/perl5/5.8.8/darwin-thread-multi-2level
    ${prefix}/lib/perl5/5.8.8
    ${prefix}/lib/perl5/site_perl/5.8.8/darwin-thread-multi-2level
    ${prefix}/lib/perl5/site_perl/5.8.8
    ${prefix}/lib/perl5/site_perl
    ${prefix}/lib/perl5/vendor_perl/5.8.8/darwin-thread-multi-2level
    ${prefix}/lib/perl5/vendor_perl/5.8.8
    ${prefix}/lib/perl5/vendor_perl
    .
--- end ---

[2]: perl 5.8.8 @INC as installed by FreeBSD ports, noe that site_perl
comes before the core module location (/usr/local/lib/perl5/5.8.8):
  @INC:
    /usr/local/lib/perl5/5.8.8/BSDPAN
    /usr/local/lib/perl5/site_perl/5.8.8/mach
    /usr/local/lib/perl5/site_perl/5.8.8
    /usr/local/lib/perl5/site_perl/5.8.7
    /usr/local/lib/perl5/site_perl
    /usr/local/lib/perl5/5.8.8/mach
    /usr/local/lib/perl5/5.8.8
    .
--- end ---






On Sat, Dec 22, 2007 at 08:37:46AM -0500, robert delius royar wrote:
> Sat, 22 Dec 2007 (00:54 +0100 UTC) Vincent Lefevre wrote:
> 
> >On 2007-12-21 10:34:00 -0500, robert delius royar wrote:
> >>I compiled perl 5.10.0 with the same configuration that macports 5.8.8
> >>used.  [I have the perl5.8 port set as the primary perl interpretor and
> >>have created links in /usr/local/[bin|lib|share] to make it so that
> >>other software finds macports perl before the system one--including
> >>apache.]
> >>
> >>When I tried to run a module through 5.10.0 from CPAN (Net::TiVo),
> >>5.10.0 failed because a bundle from macports (p5-digest-sha1) referenced
> >>a symbol not in the 5.10.0 version:
> >[...]
> >
> >I'd say that you probably need to recompile every module (well, those
> >that don't contain just Perl code) against 5.10. BTW, that may be a
> >reason to have a single Perl port installed (activated). Otherwise
> >the risk of using some module with a different Perl version for which
> >it has been built would be too high IMHO.
> 
> I have the latest version of perl5.8.8 (from macports) installed:
>  % port installed perl5.8
>  The following ports are currently installed:
>    perl5.8 @5.8.8_0+darwin_8+shared+threads
>  % port outdated perl5.8
>  No installed ports are outdated
> However, occasionally I have had to abort installs of other software 
> because that software requires perl5.8 and tries to install it.  I would 
> not want that to be the case with software wrt perl5.10 because that 
> could hose a system with a lot of perl 5.8 modules that have been 
> compiled and linked into bundles.
> 
> >
> >>dyld: lazy symbol binding failed: Symbol not found: _Perl_Tstack_sp_ptr
> >>  Referenced from: 
> >>  /opt/local/lib/perl5/site_perl/5.10.0/darwin-thread-multi-2level/auto/Digest/SHA1/SHA1.bundle
> >>  Expected in: dynamic lookup
> >>
> >>dyld: Symbol not found: _Perl_Tstack_sp_ptr
> >>  Referenced from: 
> >>  /opt/local/lib/perl5/site_perl/5.10.0/darwin-thread-multi-2level/auto/Digest/SHA1/SHA1.bundle
> >>  Expected in: dynamic lookup
> >>
> >>Trace/BPT trap
> >>
> >>I suspect there may be a number of these. Perl_Tstack_sp_ptr() was in
> >>CORE in 5.8.  I believe that it is part of the pre-5.8 legacy code and
> >>in there for compatibility with verions that expected functions for what
> >>are array or incrementable pointer variables.
> >>
> >>It is defined in the 5.8.8 source in perlapi.h but not defined anywhere
> >>in the 5.10.0 source.
> >
> >I don't know what you try to mean exactly, but Digest-SHA1 2.11 is
> >compatible with Perl 5.10 as you can see:
> >
> > http://cpantesters.perl.org/show/Digest-SHA1.html
> 
> The API has changed and the symbol Perl_Tstack_sp_ptr is not in the 
> current API.  It was in 5.8.8 and before.  The discussion I have been 
> able to Google points to this symbol being a problem if old code is not 
> recompiled with the new libperl.
> 
> I think moving up to perl5.10 is more drastic for the user than was 
> 5.6 to 5.8.  Somehow the user should be warned that all bundles (I 
> suppose mod-perl and its companionions, also) will need to be 
> reinstalled or recompiled for 5.10
> 
> Because macports does not add any earlier directories to @INC, the user 
> would just see these errors as not being able to locate a module, rather 
> than the missing symbol error.  Still, it means a bit of work for 
> someone who has a number of bundles.  The user should be told that ahead 
> of time.
> 
> >Vincent Lef??vre <vincent at vinc17.org> - Web: <http://www.vinc17.org/>
> >100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
> >Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)
> 
> -- 
> Dr. Robert Delius Royar                   Associate Professor of English
> Morehead State University                             Morehead, Kentucky

> _______________________________________________
> macports-dev mailing list
> macports-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo/macports-dev



More information about the macports-dev mailing list