Department of Physics AstroLab

pgplot, gfortran and ppgplot

Installing pgplot with gfortran

Under Fedora Core 6 with gfortran installed (gcc version 4.1.1 20070105 (Red Hat 4.1.1-51)), follow Eric Gourgoulhon's notes, i.e.
----------------------------------------------------------------------------------
		//------------------------------//
		//  PGPLOT quick installation   //
		// 	on a Linux computer	//
		//------------------------------//

1/ Get the source tar file from http://astro.caltech.edu/~tjp/pgplot/


2/ Execute the following, as super-user (su) :

cp pgplot5.2.tar.gz /usr/local/src

cd /usr/local/src 	  # directory for the sources

tar -zxvf pgplot5.2.tar.gz

cd pgplot

mkdir /usr/local/pgplot	  # create the directory for the binaries and font files

cd /usr/local/pgplot

cp /usr/local/src/pgplot/drivers.list .

emacs drivers.list &   	  # select (by removing the ! sign) the drivers to be 
                          # used for pgplot outputs: typically: 
                          # PNDRIV 1,2 : PNG figures (requires that the 
                          #    package libpng3-devel or an equivalent 
                          #    (libpng-devel) installed on your system)
                          # PSDRIV 1,2,3,4 : EPS figures
                          # XWDRIV 1,2 : X-window output (requires that the
                          #    package libxorg-x11-devel or an equivalent
                          #    (libX11-devel) is installed on your system)

**JRL**  Don't select the /GIF or /VGIF  otherwise a %VAL compile error will result 
(probably will need to wait until 4.3 before %VAL works)

# ----- Optional part : to increase the number of simultaneous devices -------
#                           from 8 to 32

cd /usr/local/src/pgplot/src

cp grpckg1.inc grpckg1.inc_backup  # to keep a copy of the original source file
cp pgplot.inc pgplot.inc_backup    #

emacs grpckg1.inc & # Replace " PARAMETER (GRIMAX = 8) " in line 29
                    #    by   " PARAMETER (GRIMAX = 32) "
                    
emacs pgplot.inc &  # Replace " PARAMETER (PGMAXD=8) " in line 7
                    #    by   " PARAMETER (PGMAXD=32) "               

cd /usr/local/pgplot

# ---------------------- End of optional part ---------------------------------

/usr/local/src/pgplot/makemake /usr/local/src/pgplot linux g77_gcc  # prepares
			  # the makefile for linux system + gcc compiler

# ---------------- Special treatment for gcc 4.0 (or above) ------------------
#
# If you are using the gcc 4.0 (or above) compilers (i.e. gfortran instead
# of g77), perform the following:

emacs makefile & # Replace "FCOMPL=g77"       in line 25 
                 #   by    "FCOMPL=gfortran" 
                 # 
                 # Replace "FFLAGC=-u -Wall -fPIC -O" in line 26
                 #   by    "FFLAGC=-ffixed-form -ffixed-line-length-none -u -Wall -fPIC -O"

# ---------------- End of special treatment for gcc 4.0 ----------------------

emacs makefile &  # Go to line 880 and replace
                  #     "pndriv.o : ./png.h ./pngconf.h ./zlib.h ./zconf.h"
                  # by  "pndriv.o : "

make			  # compiles the Fortran part
                          # will need libpng_devel and libX11_devel installed

make cpg		  # compiles the C part (binding to Fortran) 

emacs /usr/local/src/pgplot/makehtml &	# this file needs to be edited to 
			  #  replace the first line by
			  # 	#!/usr/bin/perl

make pgplot.html	  #  produces the html documentation	

make clean

cd /usr/local/lib	  #  libraries for local installations

ln -s /usr/local/pgplot/libpgplot.a libpgplot.a	   # F77 static library 

ln -s /usr/local/pgplot/libcpgplot.a libcpgplot.a  # C static library 

cp /usr/local/pgplot/libpgplot.so .  		   # dynamic (runtine) library 

emacs /etc/ld.so.conf &	  # edit this file to add the line /usr/local/lib

/sbin/ldconfig -v	  # updates the path for runtime libraries

ln -s /usr/local/pgplot/cpgplot.h /usr/local/include/cpgplot.h


3/ Each end user should type (or put in his .bashrc or .tcshrc file):

# if csh or tcsh shells:
setenv PGPLOT_DIR /usr/local/pgplot/   
setenv PGPLOT_DEV /xwin	  # prefered output device, an alternative is /xserve

# if bash shell:
PGPLOT_DIR=/usr/local/pgplot/
export PGPLOT_DIR
PGPLOT_DEV=/xwin	  # prefered output device, an alternative is /xserve
export PGPLOT_DEV

cd /usr/local/pgplot

./pgdemo1 		  # it should work !
--------------------------------------------------------------------------------

Installing ppgplot

Download (ppgplot-1.4.tar.gz) from http://code.google.com/p/ppgplot/

Confirm that either Numeric or numarray is installed.

In setup.py

Add      os.environ["PGPLOT_DIR"] = "/usr/local/pgplot" 
Replace "g2c" with  "gfortran"
Now
python setup.py build
python setup.py install
Test the demo python scripts in "examples"
Under Fedora Core 6 

For the numarray version 1.5.1
python na_ex_cont.py              works
python na_ex_panel.py             fails with  NameError: name 'PyObject' is not defined
python na_ex_arro.py              works
python na_ex_graph.py             works
python na_ex_sierp.py             works

For Numeric version 24.2
python ex_arro.py                 works
python ex_cont.py		  works
python ex_graph.py                works
python ex_panel.py                works
python ex_sierp.py                works

Botch for numpy

Ensure that numpy, scipy and lapack-devel is installed. If the latter is not installed you will probably get the

ImportError: /usr/lib/atlas/liblapack.so.3: undefined symbol: ATL_chemv

on loading numpy.

In "setup.py"

include_dirs = ["/usr/lib/python2.4/site-packages/numpy/core/include/numpy/"]

change "Numeric" to "numpy"

In src/_ppgplot.c change

"case PyArray_SBYTE:"  to "case PyArray_BYTE:" 

on lines 98 and 165. This seems to work ????


Back to the AstroLab Home Page jrl 2013-Dec-22 23:33:47 UTC