ubuntu debian fedora Mac install pgplot steps!!

What follows is a description of the procedure I have followed to have PGPLOT working under Mac OS X and Linux. Note that this is a two step procedure: you need to install the graphic library first, and then define some environment variables that are needed in order to work comfortably with PGPLOT. In this sense it is useful to check that the demo programs run properly.

Mac users

One of the easiest way to install PGPLOT is to make use of MacPorts. Check if MacPorts is already working in your system, and if PGPLOT is already installed, trying to execute: $ port installed pgplot If the previous command does not work, you need to install MacPorts first. I installed MacPorts downloading the "dmg" disk image installation file corresponding to my OS Version (Snow Leopard) from here. After the installation, one needs to execute (in order to ensure you have the latest revisions to the "Portfiles" needed when building and installing ports): $ sudo port -v selfupdate Once MacPorts is available, you can trivially install many packages, in particular PGPLOT: $ sudo port install pgplot Note that the previous command can take several minutes if the system detects the need of installing additional packages. The different versions of the PGPLOT library (libpgplot.* and libcpgplot.*) are installed under: /opt/local/lib. The X11 server is installed in /opt/local/bin/pgxwin_server, whereas auxiliary files (including the demos) are placed under:/opt/local/share/pgplot. After the installation, make sure that the expected environment variables are properly set (at least PGPLOT_DIR must exist; PGPLOT_DEV is also quite useful). You can check this by executing: $ echo $PGPLOT_DIR $ echo $PGPLOT_DEV If the previous environment variables are not set, you can easily define them: $ export PGPLOT_DIR=/opt/local/lib $ export PGPLOT_DEV=/Xserve It is useful to introduce those definitions in the .bashrc file at the home directory of the user. Finally, execute one of the demos in order to check that everything is fine: $ /opt/local/share/pgplot/examples/pgdemo1 $ /opt/local/share/pgplot/examples/pgdemo2 $ /opt/local/share/pgplot/examples/pgdemo3 ...  

Linux users

In Linux I always download the original source code of PGPLOT from its homepage, and install the package manually (at the time of writting these notes, the latest version is pgplot5.2.tar.gz). For this to work properly, the appropriate X11 files must be available in your machine. I also install gfortran as the Fortran compiler. Both tasks can be performed executing:  
  • Fedora: $ sudo yum install libX11-devel $ sudo yum install gcc-gfortran
  • Ubuntu: $ sudo apt-get install xorg-dev $ sudo apt-get install gfortran
  • CentOS: $ sudo yum install libX11-devel $ sudo yum install gcc-gfortran
  • OpenSUSE: $ sudo zypper install xorg-X11-devel $ sudo zypper install gcc-fortran
  • Debian: $ sudo apt-get install libX11-dev $ sudo apt-get install gfortran
In order to install PGPLOT, I follow (with a minor but important modification: the use of gfortran instead of g77) the instructions given by T.J. Pearson to install this library under Linux, which can be summarized as follows:
  1. Download the distribution file pgplot5.2.tar.gz
  2. Decompress and extract the contents of the distribution file in a source directory. In this sense, I always place pgplot5.2.tar.gz under /usr/local/src. Note that for this opperation it is probably required that you have root privileges, unless you have write access to the directories. I indicate that by changing the prompt symbol from $to #. You can either log in as root (using su in Fedora and CentOS, or using sudo su in Ubuntu), or use sudo in front of the following commands: # cd /usr/local/src # mv ~/Downloads/pgplot5.2.tar.gz . # tar zxvf pgplot5.2.tar.gz The last command will create /usr/local/src/pgplot and subdirectories.
  3. Create the directory where PGPLOT will be actually installed: # mkdir /usr/local/pgplot # cd /usr/local/pgplot
  4. Copy the file drivers.list from the source directory to the installation directory: # cp /usr/local/src/pgplot/drivers.list .
  5. Edit that file and remove the exclamation mark (first column of each row) in front of the following graphic devices: /PS, /VPS, /CPS, /VCPS and /XServe. The resulting file is also available here: drivers.list.
  6. Create the makefile. From the installation directory /usr/local/pgplot execute: # /usr/local/src/pgplot/makemake /usr/local/src/pgplot linux g77_gcc_aout
  7. Edit the file makefile and change the line: FCOMPL=g77 by FCOMPL=gfortran
  8. Compile the source files: # make # make cpg # make clean
After the installation, make sure that the expected environment variables are properly set (at least PGPLOT_DIR must exist; PGPLOT_DEV is also quite useful): $ export PGPLOT_DIR=/usr/local/pgplot $ export PGPLOT_DEV=/Xserve It is useful to introduce those definitions in the .bashrc file at the home directory of the user. Finally, execute one of the demos in order to check that everything is fine: $ /usr/local/pgplot/pgdemo1 $ /usr/local/pgplot/pgdemo2 $ /usr/local/pgplot/pgdemo3 ...
posted @ 2011-10-24 10:35  郭—大—侠  阅读(305)  评论(0编辑  收藏  举报