Gfortran

Hi

I just installed gfortran in my mac intel using your xcode/gfortran plugin.
When I tried to compile a test program on the terminal, I get this message:
gfortran: error trying to exec 'as': execvp: No such file or directory

Can anyone tell me what to do?

P.S. I had an old gfortran version that worked fine but was lost when the IT guy re-installed my system!

Re: Gfortran

Hi,

This usually means that the other developer tools aren't installed. For example if you type:

which gcc

at a prompt, what does it return? If it can't find anything, then you need to install the Xcode 2.4 on your system.

Let us know if that works,

Dave

Gfortran

Hi Dave

Thanks a lot.
I re-installed xcode and everything is working ok.

Daisy

Gfortran

Hi Dave

Thanks a lot.
I re-installed xcode and everything is working ok.

Daisy

gfortran

Hello,
I am totally an alien in mac world and I need help.
Despite of all FAQ and forums, I don't know how to install gfortran.
Thank you in advance.
AK

Curious little fortran question

I have a seemingly simple issue…

My initial goal was to get some python libraries and this has led me down an unwieldy road; I have now installed gcc and gfortran. The curious thing is that while in terminal “which gcc” or “gfortran” directs me to:

/usr/bin/gcc etc.

Shouldn’t this be: /usr/local/bin/gcc ?

I understand I can have multiple copies of these compilers but am worried that other programs will have issues locating the correct compiler. Is there a way to fix this or is this not a problem? Thanks very much.

Jon

Re: Curious little fortran question

Hi Jon,

If you have Xcode installed, then this is probably the gcc you are seeing. If you type which gfortran, that should point to the one in /usr/local/bin, assuming /usr/local/bin is in your default PATH variable. If not, you can add it. If you want to override which gcc is called you can either modify your path (not recommended), explicitly alias gcc to the one in /usr/local/bin or always use the full path to that specific gcc when compiling code.

Hope that helps,

Dave

line continuations for fixed format fortran

I have just gotten xcode (2.4) and the gfortran plugin installed and successfully ran a small test program. But when I try and bring in some of the fortran 77 fixed format code from my pc, I think I am running into issues with the line continuation in column 6.

My simple code looks something like this: (I put in dashes where I have spaces)

------program test
c
------REAL*8 krho, !rate of radical entry (1/s)
-----1 kp, !rate of propagation (L/mol/s)
-----2 fc, !frequency of term by comb in particles (1/s)
-----3 ktw !rate of water termination (L/mol/s)
------COMMON/params/krho,kp,fc,ktw
c
------krho = 8.3D0
------write(*,*)'Hello World'
c
------return
------end

The error that I receive is for each of the line continuations (1,2,3) and are of type 1. I tried all sorts of different spacing and tabbing widths, but nothing solved the problem. The error syntax is as:

/test/main.f:3.24:

REAL*8 krho, !rate of radical entry (1/s)
1
Error: Syntax error in data declaration at (1)
/test/main.f:4.7:

1 kp, !rate of propagation (L/mol/s)
1
Error: Unclassifiable statement at (1)
/test/main.f:5.7:

etc.

I miss the green background on column 6 in my visual fortran on the pc to set this column apart. Are there some settings I can change or something I am missing to get this code to work? I look forward to be able to run my programs on my mac!

Thanks very much!

line continuations for fixed format fortran

Hi Mary_tee,

did you try the F90 style line continuation with an ampersand (&) as the last sign? This did it for me when I moved my code over to gfortran.

Your code should look like this:

------REAL*8 krho, & !rate of radical entry (1/s)
-------kp, & !rate of propagation (L/mol/s)
-------fc, & !frequency of term by comb in particles (1/s)
-------ktw !rate of water termination (L/mol/s)
------COMMON/params/krho,kp,fc,ktw

And maybe you might want to convert those COMMONs into modules ...

Good luck!

Peter

how to install gfortran

Hi,

you downloaded the installer and let it do it's job, right?

Depending on your version of XCode, you need to pick the fitting version in the installer. Please let us know what exactly you have (version of OS and developer tools) and what you want, then we might be able to help you.

Regards,

Peter

gfortran

I have a need to use fortran code from projects built using XCode. I have attempted to use the Damien Bobillot plug in but, having previously used the Intel fortran in its trial mode,(I could not afford to buy it), I get errors when I try to compile code:
'could not exec /usr/bin/ifort-10.1-base/bin/ifort'
since this does not exist.
How do I point XCode to Gfortran?
Please help

geoff.S

Re: Gfortran

Hi,

You probably just need to change your build settings for the project.

In the Groups and Files pane, select the executable target you are trying to build in the Targets group. Press command-I (get info) and navigate to the Rules tab. There is probably an entry for Fortran source files, and from there you can change the "using:" entry to the gfortran compiler (I can't remember what it's referred to off the top of my head).

Hope that helps,

Dave

gfortran

Thanks for the hint. it worked.
the most obvious reasons are quite obviously the last to be looked at
thanks again
geoff.S

build errors

the gfortran is working in that the 'hello world' type of program will build. however when I try to build some of my older code involving file management I get errors of the type

Error: Syntax error in OPEN statement at (1)
open(6,file=fname,type='old',form='formatted',err=99)
1 (the 1 is under the f in fname)
fname being declared earlier in the program as character*20
I cannot find any changed syntax for the 'open' statement in the documentation - can you help me
thanks
geoff.S

Re : build errors

I tried the syntax you give with gfortran, and it compiles and runs without the type parameter.

The official syntax seems to be status= instead of type= (according to the intel fortran reference, type= is accepted 'outside of the standard'). I checked replacing type by status and it compiles on gfortran 4.3.0.

Thank you very much for the

Thank you very much for the help. My fortran codes were originally developed on DEC VAX and so contain quite a lot of non-standard bits
best wishes

geoff.S