陈桂华的活动构造分享 http://blog.sciencenet.cn/u/cgh 活动构造,也许就在你身边,也许哪天要了你的命,也许……

博文

GFortranBinaries64Linux

已有 4170 次阅读 2008-11-2 21:09 |个人分类:Linux

转自http://gcc.gnu.org/wiki/GFortranBinaries64Linux

Installation

Here are the essential steps:

  • Download the GFortran binary

  • Go into directory under which you want to put GFortran
  • Unpack the package using tar xvfz gcc-trunk-x86_64.tar.gz, which unpacks it into the directory gcc-trunk.

You may need to install some additional libraries:

Depending on your distribution, a sufficient version of these libraries might be available. Otherwise you can get the libraries (lib64*.tar.gz) used on the build server; unpack those into gcc-trunk/.

 

Using gfortran

Now you should be able to use gfortran. You should first check whether $your_path/gcc-trunk/gfortran --version works and whether it shows the right date. (The first line of output should looks like: GNU Fortran 95 (GCC) 4.2.0 20060725 (experimental).)

  • Remember to use either -static or set an appropriate LD_LIBRARY_PATH otherwise the gfortran.so library might not be found or the wrong library is used (e.g. older installation, system installation). You could also use -rpath (discouraged if you distribute your program). Note that your library path depends whether you compile for 32 (-m32) or 64 bit (default or -m64).

 

Examples for setting the LD_LIBRARY_PATH

These examples assume that you installed gfortran at /opt/gcc-trunk.

Using the sh/bash/ksh etc. shell (and 64 bit libraries):

  if [ -z "$LD_LIBRARY_PATH ]; then
    LD_LIBRARY_PATH="/opt/gcc-trunk/lib64"
  else
    LD_LIBRARY_PATH="/opt/gcc-trunk/lib64:$LD_LIBRARY_PATH"
  fi
  export LD_LIBRARY_PATH

and an example for 32bit using the csh/tcsh shell:

  if !($?LD_LIBRARY_PATH) then
    setenv LD_LIBRARY_PATH "/opt/gcc-trunk/lib"
  else
    setenv LD_LIBRARY_PATH "/opt/gcc-trunk/lib:$LD_LIBRARY_PATH"
  endif

(One should not use "/opt/gcc-trunk/lib:$LD_LIBRARY_PATH" if LD_LIBRARY_PATH is unset. The reason is that in that case the current directory is automatically included in the library path, which can be exploited by malicious users by placing a tinkered library in, e.g., /tmp.)



https://blog.sciencenet.cn/blog-73355-45184.html

上一篇:郎咸平:股市肯定还会跌 救楼市不是救房价救开发商
下一篇:linux内核和版本查询命令
收藏 IP: .*| 热度|

0

评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

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

GMT+8, 2024-4-28 06:09

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部