LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-18-2011, 06:06 PM   #1
DanSandbergUCONN
LQ Newbie
 
Registered: Jun 2009
Posts: 3

Rep: Reputation: 0
compiling fortran code in SuSe 11.3


Hi All - I can compile an old fortran program on my macbook using the Absoft fortran compiler and the command:

f90 –s –w –W132 –C SOURCECODE.f –lU77 –lV77

Unfortunately I cannot find f90 for linux. I can, however, find gfortran. However, gfortran does not recognize the flag -W132 and when I remove -W132 the compiler thinks all lines end after a certain number of characters. Does anyone know what flags call the equivalent type of compilation using gfortran? Is it possible I need to use f90? If so, is there a free version of f90 for linux?
 
Old 05-19-2011, 12:52 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Look at the man page for gfortran. Two options seem to be relevant: -ffixed-line-length and -ffree-line-length.
 
Old 05-19-2011, 08:57 AM   #3
DanSandbergUCONN
LQ Newbie
 
Registered: Jun 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks Nylex. Adding -ffree-line-length-none seems to have fixed that problem but now I'm getting other errors. Compiling FORTRAN code always seems like a battle. I'll keep at it but if anyone is experienced to know what's up the problem now I'm getting:

sizesmndoci.inc:1.1:
Included at mndoci50v5.CL.nocomments.f90:4:

*COMDECK SIZES*****************************************************************
1
Error: Invalid character in name at (1)
mndoci50v5.CL.nocomments.f90:5.1:



Seems like the compiler does not like the '*' character to indicate comments.

Last edited by DanSandbergUCONN; 05-19-2011 at 09:01 AM.
 
Old 05-21-2011, 04:17 AM   #4
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
I can't really help with this, I'm afraid, as I'm not a Fortran programmer. The only suggestion I have is to change the '*' to '!' at the beginning of the line, since '!' is the comment character I've seen in Fortran code.

Hopefully someone else will be able to provide a better suggestion.
 
Old 05-21-2011, 08:04 AM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Quote:
Originally Posted by Nylex View Post
I can't really help with this, I'm afraid, as I'm not a Fortran programmer. The only suggestion I have is to change the '*' to '!' at the beginning of the line, since '!' is the comment character I've seen in Fortran code.

Hopefully someone else will be able to provide a better suggestion.
I can confirm what stated. Fortran90 and later standards use an exclamation mark as comment, either at the beginning of the line or in the middle: everything following a ! is treated as a comment and ignored by the compiler.

Moreover when compiling a code with recent compilers it's better to not mix the old Fortran77 syntax with the new Fortran90/95/2003. Some compilers work fine, others can be garbled by the different specifications. Not to mention that the new Fortran standard has features that greatly improve the performance and the flexibility of the programming style.

Not an advertisement (I'm not involved with the author or the publisher in any way) but a great book to advise: Fortran 95/2003 for Scientists & Engineers by Stephen Chapman. A must read for Fortran programmers!
 
Old 05-23-2011, 05:23 PM   #6
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 727

Rep: Reputation: 74
Hi.

I agree with colucix -- don't mix old and new Fortran.

A perl code appeared in comp.lang.fortran to identify old Fortran features. As far as I know, it does not convert code:

http://groups.google.com/group/comp....2ed9108b?pli=1

a number of tools and libraries for Fortran, free and not-free can be found at:

http://fortran.com/

The snippets you posted look like fragments from old CDC Fortran -- COMDECKs were a feature of the source control program UPDATE (or perhaps MODIFY -- it's been a long time).

Best wishes ... cheers, makyo
 
Old 05-23-2011, 06:48 PM   #7
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016, Slack14.1 Deb Jessie, + 50+ other Linux OS, for test only.
Posts: 16,276

Rep: Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154
The f77 compiler is available too for Suse 11.3 :


# zypper in gcc33-fortran : Will provide /usr/bin/g77-3.3
 
Old 05-24-2011, 09:33 AM   #8
DanSandbergUCONN
LQ Newbie
 
Registered: Jun 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks all for the posts. This program is not my code and is a nightmare. We are working on re-coding in a different language entirely but until then we need to run the program to perform some benchmark tests after minor modifications. As I said it compiles fine on my mac running Absoft's f90 compiler but for some reason the gfortran compiler really does like it. Thanks again all.
 
Old 05-24-2011, 11:42 AM   #9
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 727

Rep: Reputation: 74
Hi.

I often use ftnchek on old, unfamiliar-to-me Fortran-77 codes. It looks at the semantics of your code as well as the syntax. It's free, and may be in your repository. If not, you can look at http://www.dsm.fordham.edu/~ftnchek/

If you are using gfortran, you might try changing the file name to SOURCECODE.f90 -- just a thought.

Best wishes ... cheers, makyo

Last edited by makyo; 05-24-2011 at 11:45 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fortran code on 32/64bit machine Matz Programming 3 06-12-2009 07:26 AM
Calling Fortran 95 code in C srunni Programming 2 04-15-2009 09:15 AM
Using C Preprocessor on Fortran Code mkrems Programming 4 07-08-2008 11:14 PM
compiling for fortran mperez Programming 4 05-28-2007 01:42 PM
compiling c code in SuSe 10 ?! mmattax Linux - Newbie 7 02-09-2006 08:58 PM


All times are GMT -5. The time now is 10:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration