in reply to Installing external libraries for perlbrew perl

However, I don't know how to install external libraries - e.g. libgd - in a way that my new perl can find them

I think most people attack this the other way around - they build their perl in such a way that it automatically finds the existing external libraries by, eg, ensuring that the path to these external libraries is built into $Config{libpth}. (Running perl -V:libpth will print out the existing value of $Config{libpth}.)
Not sure how you'd achieve that with perlbrew - I build perl often enough, but I don't use perlbrew (and I doubt that I ever will).

Another option that should work if you're using a gcc compiler is to set a couple of environment variables:
export CPATH=/opt/local/include:$CPATH export LIBRARY_PATH=/opt/local/lib:$LIBRARY_PATH
Does that second option work for you ?

Cheers,
Rob

Replies are listed 'Best First'.
Re^2: Installing external libraries for perlbrew perl
by bangor (Monk) on Dec 19, 2013 at 03:50 UTC
    Hi Rob. perl -V:libpth gives me:
    libpth='/opt/local/lib /usr/lib';
    I have the gd library installed there but when I try to install GD.pm using cpan I get the error
    **UNRECOVERABLE ERROR** Could not find gdlib-config in the search path.
    Now I can see that gdlib-config is in /opt/local/bin. Is there any way to tell cpan that? Thanks
      Greetings, bangor.

      What shell area you using? Like sh, bash, csh, tcsh, zsh, etc. Chances are you should be able to simply open your terminal app, and do

      $PATH
      This will likely emit a long string. Which will contain all the directories within your search %PATH. Are any of the directories that you indicate your failed install(s) are complaining about, in the string of directories $PATH told you about?

      You do know that perlbrew messes with your {ENV}vironment, don't you? You should already have a "system" Perl installed -- that which the OS installed, as part of it's base. Your ENV determines which Perl is used, whenever you type "perl" in your terminal.

      At this point, I can't help but think your ENV is hosed. Not that it can't be corrected. But you will need to know which Perl you're running under. Because it makes all the difference, when using Perl, and when, and where to install Modules, and their dependencies.

      HTH

      --Chris

      Yes. What say about me, is true.
      
        $PATH gives me
        -bash: /Users/user/perl5/perlbrew/bin:/Users/user/perl5/perlbrew/perls +/perl-5.14.1/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X1 +1/bin: No such file or directory
        I think I'm getting somewhere now. I added the following line to my bash profile
        export PATH=/opt/local/bin:/opt/local/sbin:$PATH
        That also changes my perl version to the one in /opt/local/bin but I can invoke cpan with
        sudo /Users/user/perl5/perlbrew/perls/perl-5.14.1/bin/perl5.14.1 -MCPA +N -e shell
        Now when I try to install GD it nearly succeeds, failing 1 test out of 13 which seems to be something to do with the JPEG library. I'll have to figure that out tomorrow as I'm exhausted now. Thanks for the help.
      is /opt/local/bin in $PATH?
        Sorry for my ignorance but how can I find that out?