madorb has asked for the wisdom of the Perl Monks concerning the following question:

So I'm attempting to install some modules into a local directory at the command prompt on solaris using perlgcc. I've done the following:

perl Makefile.PL PREFIX=~/perl_mods/; make; make test; make install;
for multiple modules and it's worked fine. I've installed XML::Lib::Common and can see it at:

~/perl_mods/lib/site_perl/5.8.4/sun4-solaris-64int/XML/LibXML/Common.p +m


When I attempt to install a module (XML::LibXML) that depends on that module though i get the following:
bash-3.00$ /usr/perl5/bin/perlgcc Makefile.PL PREFIX=~/perl_mods enable native perl UTF8 running xml2-config...ok (2.6.23) looking for -lxml2... yes Checking if your kit is complete... Looks good Warning: prerequisite XML::LibXML::Common 0.13 not found. Writing Makefile for XML::LibXML


So while the module is installed, it's not visible, i've tried setting  PERL5LIB=/home/me/perl_mods/ and PERL5LIB=/home/me/perl_mods/lib/ both no avail.

Anyone know why at install time it can't seem to find these modules?

Replies are listed 'Best First'.
Re: Error during manual local module install
by ikegami (Patriarch) on Jul 22, 2009 at 23:39 UTC

    PREFIX sets a poor default for LIB, so I use

    perl Makefile.PL PREFIX=~ LIB=~/lib/perl5 (Old and new MM::EU)

    or the equivalent

    perl Makefile.PL INSTALL_BASE=~ (Newer MM::EU only)

    and set PERL5LIB to

    ~/lib/perl5

    If you used

    perl Makefile.PL PREFIX=~/perl_mods LIB=~/perl_mods/lib/perl5

    you'd set PERL5LIB to

    ~/perl_mods/lib/perl5

    With the options you *did* choose, it seems you should be setting PERL5LIB to

    ~/perl_mods/lib/site_perl/5.8.4

    or maybe just

    ~/perl_mods/lib/site_perl

    Don't forget to use /home/... instead of ~ in places where ~ isn't expanded.

    If you're still having problems, please provide the output of perl -V (uppercase "V"), if only the part near the bottom that lists %ENV and @INC.

Re: Error during manual local module install
by markkawika (Monk) on Jul 22, 2009 at 23:36 UTC

    I believe you haven't set your PERL5LIB variable correctly. Assuming your home directory is /home/me, you'll need to set your PERL5LIB environment variable to /home/me/perl_mods/lib/site_perl/5.8.4. You may also have to include the architecture-specific directory, even though the perlrun man page says it searches them automatically. If so, set the variable to /home/me/perl_mods/lib/site_perl/5.8.4:/home/me/perl_mods/lib/site_perl/5.8.4/sun4-solaris-64int.

    Try that and see if it works.

    After you set it, you can run perl -V and see if it's picked up the change. Look in the @INC: section to see if it shows your new directory.

      That did it, i'm still a bit confused as to the level and where/why modules end up in either
      ~perl_mods/lib/site_perl/ or
      ~perl_mods/lib/site_perl/5.8.4/sun4-solaris-64int or
      ~perl_mods/lib/sun4-solaris-64int

      How is it determine WHERE a module lives?
        It really doesn't matter. If you use PREFIX=~perlmods , then you have PERL5LIB=~perlmods you might have to expand the ~ yourself, but that is all you have to do. Perl takes care of the rest.
Re: Error during manual local module install
by JavaFan (Canon) on Jul 22, 2009 at 23:19 UTC
    From the information you are given, I cannot see which version of XML::LibXML::Common is installed, nor what architecture you are using (are you using a perl with 64bit integers when running perl Makefile.PL?).

    I also don't know what 'perlgcc' is doing.

      XML::LibXML::Common is version 0.13. I'm using perl on solaris 5.10 (i think 64bit)

      The perlgcc is a fun bit to get around the fact that solaris' perl distro is compiled with a compiler that doesn't ship with the os. The source of it is:

      #!/usr/perl5/5.8.4/bin/perl eval 'exec /usr/perl5/5.8.4/bin/perl -S $0 ${1+"$@"}' if 0; # not running under some shell # # Copyright 2004 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # #ident "@(#)perlgcc 1.1 04/06/09 SMI" # use 5.8.4; use strict; use warnings; our $VERSION = '1.1'; $ENV{PERL5_OVERRIDE_CONFIG} = '1'; if (exists($ENV{PERL5LIB})) { $ENV{PERL5LIB} = "/usr/perl5/5.8.4/lib/Sun/Solaris/PerlGcc:$ENV{PERL5LIB}"; } else { $ENV{PERL5LIB} = '/usr/perl5/5.8.4/lib/Sun/Solaris/PerlGcc'; } exec('/usr/perl5/5.8.4/bin/perl', @ARGV) || die("Can't exec /usr/perl5/5.8.4/bin/perl: $!\n");
Re: Error during manual local module install
by Bloodnok (Vicar) on Jul 22, 2009 at 23:38 UTC
    Sorry if this is too obvious, but, although you say you've set PERL5LIB, have you exported it? Without this step [export], the/any variable is available only to the current process i.e. not to any sub-process(es) thereof e.g. perlgcc ... whatever that may be.

    A user level that continues to overstate my experience :-))