You are here: Matthew KENWORTHY > Nelse > Compiling Perl and PDL from Scratch

Compiling Perl and PDL from Scratch


I want a fresh, clean install of PDL and Perl in a home directory.

Getting Perl and compiling for local home directory

I messed up my Mac OS X installation of Perl, so I'll roll my own and also work out in the process what environment variables I need to set to do this. Could be a long time.

mkdir myperl
cd myperl/
wget http://www.cpan.org/src/perl-5.8.9.tar.gz

The README.macosx claims that /usr/local/ is the default installation point for externally compiled perls.

INSTALL also says that you can install locally with:

sh Configure -Dprefix='/Users/mattk/myperl/' -de

Adding ''-de'' just answers 'yes' to the huge list of questions. Lots of scrolling stuff, now trying to make it....

make

This seems to work! Now going for the test.....

make test

The only time it really coughed was with:

lib/overload....................................ok
lib/perl5db.....................................dyld: lazy symbol
binding failed: Symbol not found: _Perl_Gthr_key_ptr
  Referenced from:
/Library/Perl/5.8.6/darwin-thread-multi-2level/auto/Term/ReadLine/Gnu/Gnu.bundle
  Expected in: dynamic lookup

dyld: Symbol not found: _Perl_Gthr_key_ptr
  Referenced from:
/Library/Perl/5.8.6/darwin-thread-multi-2level/auto/Term/ReadLine/Gnu/Gnu.bundle
  Expected in: dynamic lookup

# Failed at ../lib/perl5db.t line 73
#      got 'main::(../lib/perl5db/t/eval-line-bug:6):
# 6:    my $i = 5;
#  support available.
# 
# Enter h or  h' for help, or an perldebug' for more help.
# 
# '
# expected /(?-xism:sub factorial)/
FAILED at test 1
lib/PerlIO/via/t/QuotedPrint....................ok

It still insists on having an @INC with 5.8.6 in front of everything, though... not sure what this means.

make install

And we're done. But...

0-(mattk@limey:~/myperl/perl-5.8.9)$ ../bin/perl -e 'use PDL;'
dyld: lazy symbol binding failed: Symbol not found: _Perl_Gthr_key_ptr
  Referenced from:
/Library/Perl/5.8.6/darwin-thread-multi-2level/auto/PDL/Core/Core.bundle
  Expected in: dynamic lookup

dyld: Symbol not found: _Perl_Gthr_key_ptr
  Referenced from:
/Library/Perl/5.8.6/darwin-thread-multi-2level/auto/PDL/Core/Core.bundle
  Expected in: dynamic lookup

Trace/BPT trap

Hmm, something with deliberately not building the dynamic version of Perl... but then 'make test' works and 'make install' gives me a local personal version of perl!

Installing OpenGL (POGL) from Source

Put in Perl OpenGL (POGL) interface:

wget http://search.cpan.org/CPAN/authors/id/C/CH/CHM/OpenGL-0.58_005.tar.gz
tar zxvf OpenGL-0.58_005.tar.gz
cd OpenGL*
../bin/perl Makefile.PL PREFIX=~/myperl
make test
<wheee! teapots!>
make install

Okay, so a final check that POGL got installed:

../bin/perl -e 'use OpenGL;'

...should return a blank line if all is good.

(optional) Setting up CPAN

I'm now adding some Perl modules from CPAN, using this newly compiled Perl - when you run it for the first time, there are a lot of prompts. Default options are fine, but there are two which I add. When prompted for "prerequisites policy" go for "follow" so that you don't have to press "ENTER" a dozen times for each prerequisite.

Also add ''PREFIX=~/myperl'' when propmpted so that you definitely don't build modules into Apple's Perl.

"prerequisites_policy" follow
PREFIX=~/myperl

Install the Bundle::CPAN as that contains Term::ReadLine and Term::ReadKey which give line editing and control in the perldl shell:

./bin/perl -MCPAN -e 'install Bundle::CPAN'

(optional - may not be needed now) Now, install the YAML and LWP modules so that the CPAN installation remembers the long list of options you typed in.

./bin/perl -MCPAN -e 'install YAML::Any;'
./bin/perl -MCPAN -e 'install LWP::Simple;'

(optional) Installing PGPLOT

PGPLOT itself (to be done...)

Installing the two Perl modules to get PGPLOT linked into Perl:

./bin/perl -MCPAN -e 'install ExtUtils::F77;'
./bin/perl -MCPAN -e 'install PGPLOT;'

The installation will run through pgplot display tests if successful.

Getting and compiling PDL

Getting the latest developers copy of PDL:

git clone git://pdl.git.sourceforge.net/gitroot/pdl/pdl PDL
cd PDL
../bin/perl Makefile.PL PREFIX=~/myperl

make
make test
make install

Trying to run

$ ./bin/perl -e 'use PDL::Graphics::OpenGL::Perl::OpenGL;'
$ ./bin/perl -e 'use  PDL::Graphics::TriD;'

...both work OK. Now run the test:

$ ../bin/perl -Mblib 3dtest.pl
$im3 has dims of 3 640 480
get_current_window - creating window...
PDL::Graphics::TriD::Window - calling SUPER::new...
PDL::Graphics::TriD::Window - got back
PDL::Graphics::TriD::Window=ARRAY(0xc9a5e0)
PDL::Graphics::TriD::Window: calling gdriver....
GL gdriver...
Your vendor has not defined OpenGL macro GLX_DOUBLEBUFFER, used at
/Users/mattk/myperl/PDL/blib/lib/PDL//Graphics//TriD//GL.pm line 601.
AUTOLOAD: DESTROY at
/Users/mattk/myperl/PDL/blib/lib/PDL/Graphics/TriD/Window.pm line 224.
Window AUTOLOADing 'DESTROY':
self=PDL::Graphics::TriD::Window=ARRAY(0xc9a5e0), args=''