This document details how to install the Fortran compiler in Linux.
1. Open http://gcc.gnu.org/wiki/GFortranBinaries in a browser
2. Download the 2-in Linux version, my Linux is fedora16, x86-64, so I chose http://gcc.gnu.org/wiki/gfortranbinariesunder
64-bit amd-compatible processors (x86_64, amd64, intel64, em64t)
2.1 find a file and download it to the local machine, I chose http://gfortran.com/download/x86_64/nightlies/gcc-trunk-20120601-r188095.tar.xz
2.2 download gcc-infrastructure.tar.xz
3. decompress the two. xz files in the compressed file to the. tar file. I use PeaZIP or another tool to decompress the file.
4. Copy the gcc-infrastructure.tar and gcc-trunk-20120601-r188095.tar of the file unwrapped in the previous step to the Linux PC/opt/directory, which requires root permissions
5. Expand gcc-trunk-20120601-r188095.tar to the/OPT directory,
CD/OPT
Tar-XF gcc-trunk-20120601-r188095.tar
6. Move the gcc-infrastructure.tar to GCC-trunk
Music gcc-infrastructure.tar./GCC-trunk/
7. Expand gcc-infrastructure.tar to the/opt/GCC-trunk/lib64 directory
Tar-XF gcc-infrastructure.tar
8. Delete the original tar file (omitted)
9. Create an F. Sh file in your home directory or another directory. The content is as follows:
#! /Bin/bash
If [-z "$ LD_LIBRARY_PATH"]; then
Export LD_LIBRARY_PATH = "/opt/GCC-trunk/lib64"
Else
Export LD_LIBRARY_PATH = "/opt/GCC-trunk/lib64: $ LD_LIBRARY_PATH"
Fi
Export Path =/opt/GCC-trunk/bin: $ path
10. Run source F. Sh in your home directory to set environment variables.
This is, you can use gfortran to compile and link your FORTRANProgramYou can use gfortran -- version to check your compiler version.