||
参考:http://pendientedemigracion.ucm.es/info/Astrof/software/howto/howto-pgplot.html
Fedora:
sudo yum install libX11-devel
sudo yum install gcc-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 toinstall this library under Linux, which can be summarized as follows:
Download the distribution file pgplot5.2.tar.gz
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.
Create the directory where PGPLOT will be actually installed:
# mkdir /usr/local/pgplot
# cd /usr/local/pgplot
Copy the file drivers.list from the source directory to the installation directory:
# cp /usr/local/src/pgplot/drivers.list .
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.
Create the makefile. From the installation directory /usr/local/pgplot execute:
# /usr/local/src/pgplot/makemake /usr/local/src/pgplot linux g77_gcc_aout
Edit the file makefile and change the line:
FCOMPL=g77
by
FCOMPL=gfortran
Compile the source files:
# make
# make cpg
# make clean
After the installation, make sure that the expected environment variables areproperly set (at least PGPLOT_DIR must exist; PGPLOT_DEV isalso quite useful):
$ export PGPLOT_DIR=/usr/local/pgplot
$ export PGPLOT_DEV=/Xserve
It is useful to introduce those definitions in the .bashrc file at thehome directory of the user.
Execute any of the demos in order to check that everything is fine:
$ /usr/local/pgplot/pgdemo1
$ /usr/local/pgplot/pgdemo2
$ /usr/local/pgplot/pgdemo3
...
Finally, compile your own code. For example, is gfortran was thefortran compiler employed to install PGPLOT, the following commandshould work:
$ gfortran -o outputFileName inputFotranFile.f -L/usr/local/pgplot-L/usr/X11/lib -lpgplot -lX11
Note that you should use the same fortran compiler to install PGPLOT and tocompile your own files.In the above example the X11 library was assumed to be installed in/usr/X11/lib. If this is not the case, include the actual directoryusing -L/directory_path_to_libX11 in the compilation instead of-L/usr/X11/lib above.
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-4-26 08:13
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社