gfortran 90 compiler for ubuntu

Asked by SatishCWani

Dose the command : sudo apt-get install gfortran, installs fortran from net directly.

I have a Ubuntu CD, but don't find any fortan compiler. gcc also dosen't compile fortran programs.

What is the best way install fortran compiler without internet connection?

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Ralph Janke (txwikinger) said :
#1

Thanks for the question.

You can download the .deb files you need on a networked computer and and but them on a CD. Then you can install the packages via

sudo dpkg --install <packagename>

I hope this helps.

Revision history for this message
SatishCWani (wsc2189) said :
#2

Thanks Ralph for your suggestion. However i still have a question.

To compile fortran file, which .deb file is needed to be downloaded and where can i find this file?

Revision history for this message
Harvey Muller (hlmuller) said :
#3

Satish,

There are two fortran compilers that may suit your need. They are g77 (GNU Fortran 77 compiler) and gfortran (Gnu Fortran 95 compiler. I am not familiar with fortran, but would expect that gfortran is the newer flavor.

So you first decide which you want:

    g77
    gfortran

Once you have decided (maybe you want both?), open up synaptic (assuming gnome):

    System > Administration > Synaptic Package Manager

Search for the package you want, and mark it. Synaptic will identify dependencies needed. Once you have marked the package (gfortran, g77), in Synaptic navigate to:

    File > Generate package download script

It will ask you where you want to save the file, give it any name you desire.

When it is done, you can open up the file with a text editor and you will have all the package names and web addresses. Either print this, or write them all down. If you write them down, doublecheck to make sure you wrote them down correctly.

Take the list to a networked computer, navigate to each file in a browser, save them to removable media that your non-networked computer can use. Take them back to your non-networked computer, mount the media. You can either use nautilus to navigate to the media and doubleclick each file to install it, or you can use File > Add downloaded packages in Synaptic.

Please report back here and let me know if this Solves your question.

Thanks,

Harvey

Revision history for this message
SatishCWani (wsc2189) said :
#4

Harvey, thanks for your guidelines, but i have Kubuntu. I thinking of migrating to Ubuntu.

However based on Ralph's suggestion i had tried out as below,

I downloaded the gfortran_4.1.2-1ubuntu1_amd64.deb file and from Desktop console i ran the below command:

sudo dpkg --install gfortran_4.1.2-1ubuntu1_amd64.deb

This gave the result:

Result
satish@satish-desktop:/tmp$ sudo dpkg --install gfortran_4.1.2-1ubuntu1_amd64.deb
(Reading database ... 65503 files and directories currently installed.)
Preparing to replace gfortran 4:4.1.2-1ubuntu1 (using gfortran_4.1.2-1ubuntu1_amd64.deb) ...
Unpacking replacement gfortran ...
dpkg: dependency problems prevent configuration of gfortran:
gfortran depends on cpp (>= 4:4.1.2-1ubuntu1); however:
Package cpp is not installed.
gfortran depends on gcc (>= 4:4.1.2-1ubuntu1); however:
Package gcc is not installed.
gfortran depends on gfortran-4.1 (>= 4.1.2); however:
Package gfortran-4.1 is not installed.
dpkg: error processing gfortran (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
gfortran

I guess the gcc compiler and some cpp compiler is clashing with gfortran compiler. Am i correct? If yes how do i solve this problem.(I have Kubuntu installed on AMD64 machine). Would it be good if i migrate to Ubunutu?

Satish

Revision history for this message
Harvey Muller (hlmuller) said :
#5

Satish,

If you search for gfortran in synaptic, mark it, and then generate the download script as suggested above, you would have identified all of the packages (dependencies) required.

The problem is with dependencies, not clashing. gfortran depends on gcc and cpp. Give my suggestion a try, and you will have identified all required packages, and their download locations.

Please report back here if this Solves your question.

Thanks,

Harvey

Can you help with this problem?

Provide an answer of your own, or ask SatishCWani for more information if necessary.

To post a message you must log in.