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

I'm having trouble finding the right mix of environment vars and MakeMaker/Module::Build directives to build CPAN modules in a specific environment, and I could use some help.

The setup:

  1. I am using a compiled-from source perl, configured during the build process to be installed in /tmp/foo/.
  2. I have a build script that iterates through a set of CPAN modules in a directory, and builds/installs them in another path (/tmp/cpan) using /tmp/foo/bin/perl in the build process.

This works fine, with CPAN modules using both MakeMaker and Module::Build.

Now the problem:

perl, compiled and installed to /tmp/foo, might get moved to /tmp/bar. No recompilation of perl is possible at this point.

The build script must work now with /tmp/bar/bin/perl to build CPAN modules.

And this is where I'm getting stuck. Pure-perl modules seem to be ok with an updated $PERL5LIB, but modules that require C header files don't want to cooperate. I keep running into problems with modules being unable to find CORE/perl.h.

Adding LIB, PERL_LIB, or PERL_ARCHLIB directives to the call to Makefile.PL doesn't work, and I'm stuck at this point.

Suggestions very much appreciated!

  • Comment on Need help with environment vars and building CPAN modules

Replies are listed 'Best First'.
Re: Need help with environment vars and building CPAN modules
by f00li5h (Chaplain) on Nov 05, 2008 at 00:49 UTC

    perlrun calls it PERLLIB not PERL_LIB and I don't see mention of a PERL_ARCHLIB there...

    perhaps -Idirectory will help?

    @_=qw; ask f00li5h to appear and remain for a moment of pretend better than a lifetime;;s;;@_[map hex,split'',B204316D8C2A4516DE];;y/05/os/&print;

      So it looks like I've answered my own question.

      The problem I was having isn't with core-perl per se, but to some degree with ExtUtils::MakeMaker, and also with some CPAN modules (especially those with multiple Makefile.PL's, when command-line args are not passed along).

      In the end, the easiest fix was simply to hack Config.pm to reflect the new location of perl in a few parameters. Not ideal, but to truly get it to work would require a lot of changes in a lot of modules.