LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to get Fortran90 compiler (https://www.linuxquestions.org/questions/linux-software-2/how-to-get-fortran90-compiler-700467/)

nelufarup 01-28-2009 06:02 AM

How to get Fortran90 compiler
 
I have g77 working fine in Fedora 9 (Sulphur), but recently I have got some files which can be compiled using Fortran 90 compiler. My system has Fortran 95 compiler but unfortunately it is of no help, as I cannot compile files using it. For compiling I need to use f90 command.

So please, some one can suggest how I can get fortran 90 compiler.

Thanks!

choogendyk 01-28-2009 10:21 AM

According to the Wikipedia entry on Fortran, Fortran 95 was a minor upgrade to Fortran 90. It should be compatible. So, are you saying the Fortran 95 compiler you have is nonfunctional in general or that it just doesn't work on these particular files?

At the end of the Wikipedia entry there are links to the GNU Fortran project (95/2003) and to the g95 project. Both are open source, and perhaps you could try them.

nelufarup 01-28-2009 11:14 AM

First of all thanks for the reply!

Quote:

Originally Posted by choogendyk (Post 3424128)
According to the Wikipedia entry on Fortran, Fortran 95 was a minor upgrade to Fortran 90. It should be compatible. So, are you saying the Fortran 95 compiler you have is nonfunctional in general or that it just doesn't work on these particular files?

Well, I also believed that f95 should be fine, but it seems that it does not works on these files. Actually I have some codes, which I am trying to compile for calculations and when I use f95 command it just does not produce the executable file. I have tried on other system having f90 and there it's all fine. But you can understand that it's quite difficult to always switch over systems.

Quote:

At the end of the Wikipedia entry there are links to the GNU Fortran project (95/2003) and to the g95 project. Both are open source, and perhaps you could try them.
I have tried this also but some how I don't find anywhere support to fortran 90. If you can suggest some other option it will be quite helpful.

Thank you again!

choogendyk 01-28-2009 08:48 PM

Any error messages? Are you a programmer who knows Fortran and could possibly fix incompatibilities in the code?

nelufarup 01-29-2009 03:42 AM

Quote:

Originally Posted by choogendyk (Post 3424662)
Any error messages? Are you a programmer who knows Fortran and could possibly fix incompatibilities in the code?

When I try to use f90 command on my system it just says command not found, which means Fortran 90 is not there. When I use f95 command, there is no error message but the executable file is not produced to execute the program further.
I am not a technical programmer.

Randux 01-29-2009 04:50 AM

Look at the gcc docs and there will almost certainly be, amongst the millions of unwanted and confusing switches, a switch that will compile your program in F90 mode.

colucix 01-29-2009 04:56 AM

Quote:

Originally Posted by nelufarup (Post 3424949)
When I try to use f90 command on my system it just says command not found, which means Fortran 90 is not there. When I use f95 command, there is no error message but the executable file is not produced to execute the program further.

Can you post the exact command line you used? That one with f95, I mean. Also post the output of the following command
Code:

ls -l $(which f95)
just to have an idea of which compiler it really is. I suspect f95 is just a link to another executable.

Anyway, you can try to install gcc-gfortran. Look for "fortran" in the search form of Add/Remove software or try the following if you prefer the command line package manager:
Code:

yum install gcc-gfortran

nelufarup 01-30-2009 02:57 PM

Quote:

Originally Posted by colucix (Post 3425002)
Can you post the exact command line you used? That one with f95, I mean. Also post the output of the following command
Code:

ls -l $(which f95)
just to have an idea of which compiler it really is. I suspect f95 is just a link to another executable.

I used following command line
Code:

f90 dpi.exe -o *.for
The output of the command
Code:

ls -l $(which f95)
is
Code:

lrwxrwxrwx 1 root root 8 2008-08-05 04:43 /usr/bin/f95 -> gfortran
Quote:

Anyway, you can try to install gcc-gfortran. Look for "fortran" in the search form of Add/Remove software or try the following if you prefer the command line package manager:
Code:

yum install gcc-gfortran

Unfortunately there is some problem with Add/Remove software, as it never activates. So if you can tell which compiler is this (which I guess, to be gfortran) and if it supports f90? I would prefer to install gcc-fortran as last option.

Thanks!

colucix 01-30-2009 03:07 PM

Yes, it is gfortran, which currently supports F77, F90 and F95 standard. The package gcc-fortran is already installed on your system, since it is that one which provides the gfortran executable in Fedora. However, the command line used to compile is wrong:
Code:

f90 dpi.exe -o *.for
since the -o option must be followed by a custom name for the compiled executable and must not be put after. The solution to your issue is
Code:

f90 -o dpi.exe *.for
provided f90 is a valid link to gfortran the same way as f95!

nelufarup 01-31-2009 07:44 AM

Quote:

Originally Posted by colucix (Post 3426654)
Yes, it is gfortran, which currently supports F77, F90 and F95 standard. The package gcc-fortran is already installed on your system, since it is that one which provides the gfortran executable in Fedora. However, the command line used to compile is wrong:
Code:

f90 dpi.exe -o *.for
since the -o option must be followed by a custom name for the compiled executable and must not be put after. The solution to your issue is
Code:

f90 -o dpi.exe *.for
provided f90 is a valid link to gfortran the same way as f95!

First of all, I am sorry for sending the wrong command. I have used the command as suggested by you.
But it seems that f90 is not a valid link to gfortran since this command does not works. So could you tell how can I make a valid link of f90 to gfortran?

Thanks!

terry-duell 01-31-2009 03:55 PM

Quote:

Originally Posted by nelufarup (Post 3427217)
First of all, I am sorry for sending the wrong command. I have used the command as suggested by you.
But it seems that f90 is not a valid link to gfortran since this command does not works. So could you tell how can I make a valid link of f90 to gfortran?

Thanks!

If you have gfortran, then why not simply use that command; i.e. gfortran fred.f90 -o fred?

Cheers,
Terry

colucix 01-31-2009 04:53 PM

I agree with terry-duell. You don't need links to gfortran, unless for mnemonic aid. Use gfortran command directly. Anyway, the command to create a symbolic link is ln -s. Take a look at man ls for further details.

nelufarup 02-01-2009 07:32 AM

Thanks for the command help terry-duell! I did not use it, as I did not know about it.

Anyway, I used the command but with no success. It did not produce executable file instead gave list of complains with the declarations and dimensions in the codes. Now I am completely sure that there is no problem with that, as the codes can be compiled properly on other system with out any problem.
Let me write the exact commands that I have been using on this other system to compile different files in a directory together.
Code:

f90 -o tm.exe *.for
chmod 700 tm.exe
./tm.exe

This is the reason why I have been insisting on f90 compiler. Using other compiler say gfortran or f95, though they might be supporting f90, always list complains.

Thanks!

colucix 02-01-2009 04:07 PM

Quote:

Originally Posted by nelufarup (Post 3428043)
Thanks for the command help terry-duell! I did not use it, as I did not know about it.

Well, we were talking about gfortran from the very beginning of this thread and you did not know about it? You sure?

Quote:

Originally Posted by nelufarup (Post 3428043)
It did not produce executable file instead gave list of complains with the declarations and dimensions in the codes.

Why don't you show us the exact error messages and eventually the code you're trying to compile?! Maybe we can be of more help.

Quote:

Originally Posted by nelufarup (Post 3428043)
This is the reason why I have been insisting on f90 compiler. Using other compiler say gfortran or f95, though they might be supporting f90, always list complains.

As far as I know in Linux there is not a f90 compiler, unless it is a link to some other GNU fortran only for mnemonic purposes. A f90 command was provided on Sun systems, instead. Anyway, if your code works on some machines and not on other, maybe it is not written taking in account compatibility issues. There is a chance you have just to pass some specific options to the compiler in order to achieve the compatibility, but again if we don't see the code and/or the error messages we cannot be of any help.

terry-duell 02-01-2009 04:09 PM

Quote:

Originally Posted by nelufarup (Post 3428043)
Thanks for the command help terry-duell! I did not use it, as I did not know about it.

Anyway, I used the command but with no success. It did not produce executable file instead gave list of complains with the declarations and dimensions in the codes. Now I am completely sure that there is no problem with that, as the codes can be compiled properly on other system with out any problem.
Let me write the exact commands that I have been using on this other system to compile different files in a directory together.
Code:

f90 -o tm.exe *.for
chmod 700 tm.exe
./tm.exe

This is the reason why I have been insisting on f90 compiler. Using other compiler say gfortran or f95, though they might be supporting f90, always list complains.

Thanks!

What is your 'other system' and which Fortran 90 compiler is it running?
Maybe the source is non standard.
What result do you get if you try to compile only one of the fortran source files?
Try this ... 'gfortran fred.for -o fred' where fred.for is any one of your *.for source files, and let us know the result. If you still get error messages please provide some of these so we can get an idea of what is happening. If there are only complaints (warnings) that is not unusual.

Cheers,
Terry


All times are GMT -5. The time now is 10:00 AM.