SUSE 11 sp2 安装 gcc-gfortran for


1. 下载gfortran  (Download the GFortran binary)

   gcc-4.3.tar.xz

2. 解压缩到 /(Go into directory under which you want to put GFortran)

  #/opt/gcc-4.3
  # xz -d gcc-4.3.tar.xz
  # tar xvf gcc-4.3.tar

  (Unpack the package using tar xvfz gcc-trunk-x86_64.tar.gz, which unpacks it into the directory gcc-trunk. )

3. 设置环境变量

  # vim .profile
  (在文件的最后添加两行!)
  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/gcc-4.3/lib64
  export PATH=$PATH:/opt/gcc-4.3/bin

  # source .profile 

  *  fortran 编译器位于         /opt/gcc-4.3/bin/gfortran
      执行过程需要的库文件位于     /opt/gcc-4.3/lib64

4. 检验
  # vim exma.f90

program ABC
A=9.0
B=45
write(*,*) A*B
stop
end

  # gfortran exma.f90 -o l123
  # ./l123

相关内容