zgyin的个人博客分享 http://blog.sciencenet.cn/u/zgyin



已有 3362 次阅读 2013-10-15 20:49 |系统分类:科研笔记| fedora


  • 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:

  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:

  8. 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.


收藏 IP: 159.226.88.*| 热度|


该博文允许注册用户评论 请点击登录 评论 (0 个评论)


Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2023-2-4 22:53

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社