我在哪里可以获得文件在redhat linux上安装f2c? [英] Where can I get the files to install f2c on redhat linux?

查看:194
本文介绍了我在哪里可以获得文件在redhat linux上安装f2c?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找rpm或简单的安装说明让f2c在我的redhat linux操作系统上工作。我是linux新手,很难在谷歌上找到这样的东西。



(目标是使用f2c将简单的fortran77文件转换为c,然后编译)

任何人有任何建议吗?

解决方案


  1. 使用rsync获取源代码(推荐) / p>

      $ rsync -avz netlib.org::netlib/f2c/src f2c 

    通过FTP获取资源:

      $ mkdir  - p f2c / src 
    $ cd f2c / src
    $ ftp ftp.netlib.org
    ftp> cd f2c
    ftp>提示
    ftp> mget *


  2. 要构建源代码,请在f2c / src目录中执行:

      $ make -f makefile.u 


  3. 要安装二进制文件,请将其复制到您的$ PATH中的目录中:

      $ mkdir -p /usr/local/bin/usr/local/man/man1 
    $ cp f2c / usr / local / bin
    $ cp f2c.1t / usr / local / man / man1


  4. 要编译Fortran程序,您还需要 libf2c

      $ mkdir libf2c 
    $ cd libf2c
    $ unzip ../libf2c.zip
    $ make -f makefile.u
    $ make -f makefile.u install LIBDIR = / usr / local / lib

    libf2c是 libF77 libI77 库。您可以单独安装这些库,然后使用-lF77 -lI77进行链接。假设当前目录中有f2c / src文件,请保存 libF77 libI77 ,并执行以下操作(如果您已经安装了libf2c,则不需要):

      $ sh libf77 
    $ sh libi77
    $ cd libF77
    $ make CFLAGS = -I ../ f2c / src
    $ make install LIBDIR = / usr / local / lib
    $ cd ../libI77
    $ make CFLAGS = -I ../ f2c / src
    $ make install LIBDIR = / usr / local / lib


  5. fc shell脚本是一个很好的f2c前端。将它保存到某处并执行:

      $ cp fc / usr / local / bin / f77 
    $ chmod 755 / usr / local / bin / f77

    我将它重命名为f77以避免冲突,因为fc是bash内建的。 fc脚本需要libf2c而不是libF77和libI77,因此如果您已经安装了这些库而不是libf2c,则必须对其进行编辑并将-lf2c替换为-lF77 -lI77。

  6. $
    $ b

      $ f77 source.f -o b $ li 

    最后,编译你的程序可以这样做:二进制


同时检查 f2c父目录。它包含 getopt.c f2c.pdf 以及其他可能有用的东西。



更多关于f2c请参阅自述文件( less f2c / src / readme )和联机帮助页( man f2c )。有关fc脚本的更多信息,请查看文件开头的注释。


I am looking for an rpm or simple install instructions for getting f2c to work on my redhat linux os. I am new to linux and it is difficult finding something like this on google.

(The goal is to use f2c to convert a simple fortran77 file to c, then compile)

Does anybody have any suggestions?

解决方案

  1. Getting the source with rsync (recommended):

    $ rsync -avz netlib.org::netlib/f2c/src f2c
    

    Getting the sources via FTP:

    $ mkdir -p f2c/src
    $ cd f2c/src
    $ ftp ftp.netlib.org
    ftp> cd f2c
    ftp> prompt
    ftp> mget *
    

  2. To build the sources, in the f2c/src directory do:

    $ make -f makefile.u
    

  3. To install the binary, copy it to a directory in your $PATH:

    $ mkdir -p /usr/local/bin /usr/local/man/man1
    $ cp f2c /usr/local/bin
    $ cp f2c.1t /usr/local/man/man1
    

  4. To compile Fortran programs you will also need libf2c:

    $ mkdir libf2c
    $ cd libf2c
    $ unzip ../libf2c.zip
    $ make -f makefile.u
    $ make -f makefile.u install LIBDIR=/usr/local/lib
    

    libf2c is a combination of the libF77 and libI77 libraries. You can install these libraries separately and then link with "-lF77 -lI77". Assuming f2c/src is available from the current directory, save libF77 and libI77 and do the following (not necessary if you have already installed libf2c above):

    $ sh libf77
    $ sh libi77
    $ cd libF77
    $ make CFLAGS=-I../f2c/src
    $ make install LIBDIR=/usr/local/lib
    $ cd ../libI77
    $ make CFLAGS=-I../f2c/src
    $ make install LIBDIR=/usr/local/lib
    

  5. The fc shell script is a nice frontend to use with f2c. Save it somewhere and do:

    $ cp fc /usr/local/bin/f77
    $ chmod 755 /usr/local/bin/f77
    

    I renamed it to f77 to avoid conflicts, since fc is a bash builtin. The fc script expects libf2c rather than libF77 and libI77, so you have to edit it and replace "-lf2c" with "-lF77 -lI77" if you have installed these libraries instead of libf2c above.

  6. Finally, to compile your program you can do:

    $ f77 source.f -o binary
    

Also check out the f2c parent directory. It contains getopt.c, f2c.pdf and some other stuff that may be useful.

For more further information about f2c consult the readme (less f2c/src/readme) and the manpage (man f2c). For further information about the fc script look at the comments at the beginning of the file.

这篇关于我在哪里可以获得文件在redhat linux上安装f2c?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆