List of various gotchas!
------------------------
Last Change: Jan 3rd, 2006.
Karl Glazebrook.
ExtUtils::F77
-------------
This module requires installation of ExtUtils::F77 to compile. The
latest version is v1.13 so you probably better get that from
CPAN (www.cpan.org)
Non-standard PATHs
------------------
If your PGPLOT, X11, etc. libs are located in non-standard places you may use the
following command line command line options to "perl Makefile.PL" which take comma
separated lists of values. The possible options are:
* XDIR: The directories to search for X11 libraries (without the
-L)
* XLIB: The X11 libraries to link (without the -l
* IDIR: The PGPLOT include directory
* LDIR: The PGPLOT library directory
* EXLIB: extra libraries to link (in my case it's png,z)
* EXDIR: Library directories for the extra libraries
perl5.004_?? problem
--------------------
If you type 'make' and see an error message like:
/usr/bin/perl -I/usr/lib/perl5/i586-linux/5.00404 -I/usr/lib/perl5
/usr/lib/perl5/ExtUtils/xsubpp -typemap /usr/lib/perl5/ExtUtils/typemap -typemap typemap
PGPLOT.xs >PGPLOT.tc && mv PGPLOT.tc PGPLOT.c
make: *** [PGPLOT.c] Error 139
(sometimes with a segmentation violation or bus error)
Then you have encountered a bug in perl versions 5.004_01 and later (5.004
itself works just fine). The generation of PGPLOT.c from PGPLOT.xs fails
because of a bug in xsubpp to do with handling of line numbers (of all
things).
This has been reported and ought to be fixed. Meanwhile here is
a workaround:
Edit the 'Makefile' which has been generated by the 'perl Makefile.PL ...'
command and add the '-nolinenumbers' option to the xsubpp call. The
line should look something like:
XSUBPPARGS = -nolinenumbers -typemap $(XSUBPPDIR)/typemap -typemap typemap
Then type 'make' again and everything should work.
Common Problems and Possible Solutions
--------------------------------------
*** First check the HINTS.* files for OS-specific problems. ***
If you have libpgplot set up following the recommended defaults and the
Makefile.PL recognises your system then Perl/PGPLOT should build out of the
box. If you don't you may experience problems. Read on for possible
fixes. Patches for ExtUtils::F77, to make it even smarter, are very
welcome!
o Check the -lX11 you are linking with is the same one that libpgplot
was built against! This can cause the module to die with a very
unhelpful error. Use -L/dir to fix this.
o If 'make test' does not work try 'perl -Mblib test.pl'. Sometimes
one can get funny dynamic loading problem. [The former sets
PERL_DL_NONLAZY=1 which makes it fail on any unresolved symbol.
Sometimes this is wrong.]
If 'perl -Mblib test.pl' produces sensible graphs it is probably
safe to do a 'make install'.
o Next make sure you can compile, link and run successfully PGPLOT
C programs (e.g. 'cpgdemo' in the PGPLOT distribution). If not you
will not be able to run the perl version. A common requirement is
to set the environment variable PGPLOT_DIR if PGPLOT is installed
in a non-standard location.
o You may experience problems if the module does not 'know' about
the FORTRAN/C interface on your architecture. Please contact me and I
will try to help if I have time. Alternatively - install GNU-77! (You
gnu it makes sense...) and edit 'Makefile.PL' to select GNU-77 (this
is the default on Linux, etc. anyway).
o If you are using f2c based Fortran compilers (e.g. g77 or f2c) then
it is possible that it is not picking this fact up. [e.g. on systems
where the default f77 is something else like Solaris. Note is is SUPPOSED
to figure this out. :-)]. In such cases try editing the line:
use ExtUtils::F77;
to become:
use ExtUtils::F77 qw(generic g77);
o Make sure when you build the pgplot library you did a 'make cpg' to
create the C library and the cpgplot.h header file.
o See if you can compile and run the C program cpgdemo.c which comes
with the pgplot library itself - 'make cpg' in the pgplot build sequence.
If this fails there is no way the PGPLOT module will work.
o Check Perl normal dynamic loading works, try:
perl -e 'use Socket'
and see if there are any errors. If you contact me I can supply a
simple test module.
o Using Linux and G77, you might need to ensure that libf2c.a is present
in the normal library search path. You might also need to add ' -lgcc'
after the fortran runtime library in Makefile.PL
o If using G77 check the library /usr/lib/libf2c.a is the one that came
with g77 and not an older one that comes with F2C. Check also that is is not picking up
an older shared library (e.g. /usr/lib/libf2c.so) that does not
correspond to the current libf2c.a. The g77 one should be a link to libg77, e.g.:
lrwxrwxrwx 1 root root 42 Aug 28 16:17 /usr/lib/libf2c.a ->
/usr/lib/gcc-lib/i486-linux/2.7.2/libg77.a
o Check the cc compiler you used to build cpgplot is the same one
you used to build Perl (this is the one invoked by Makefile.PL)
o Using the PGPLOT module with a dynamically loaded libpgplot
library on some UNIX systems CAN be problematic (many confusing
possibilites of -L/-R/LD_LIBRARY_PATH/LD_RUN_PATH exist). Commonly
the module builds with no errors but fails to plot anything. You can
maybe fix this by ensuring the pgplot libraries are linked in to
/usr/local/lib/ (as per the pgplot install instructions) or
alternatively playing with LD_LIBRARY_PATH. If this fails try
deleting the libpgplot.so* or libpgplot.sl* shareable library (or at
least move it to /tmp!). Alternatively, if you don't have system
priviledge, try this dirty hack:
mkdir pgplot_tmp
cp /usr/local/pgplot/lib*pgplot.a pgplot_tmp
ranlib pgplot_tmp/*
(don't worry if the 'ranlib' command gives an error - many UNIX
systems don't have or need it.)
Now start from the top again. The Makefile.PL will automatically
detect 'pgplot_tmp' and link in these files statically.
o Finally, if you mail me for help include in your message the complete log
output of:
perl -V; perl Makefile.PL; make; make test
Architecture-Specific Problems/Tips
-----------------------------------
HP systems - Try using c89 with HP's fort77 compiler rather than gcc.
(e.g. if you get a message about not being able to resolve symbol
'__main__')
DEC Alphas - are suceptible to the LD_LIBRARY_PATH problems mentioned
above.
RedHat 5.2 is reported to work with the following RPMs for C and FORTRAN :-
egcs-c++-1.0.3a-1
egcs-1.0.3a-1
egcs-objc-1.0.3a-1
egcs-g77-1.0.3a-1
f2c-19970805-3