Install the Fortran compiler in Linux

Source: Internet
Author: User
Tags gfortran

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.