help install gfortran on Mac OS X version 10.5.6

171 views
Skip to first unread message

jon

unread,
Apr 15, 2009, 7:23:12 AM4/15/09
to GNU Fortran
Mac with macosx 10.5.6 Build 9G55 (gfortran version stuff below).
Gfortran will not compile any code. I'm at a dead end trying to figure
this out. Any help would be greatly appreciated.

I downloaded and installed gfortran from (and as instructed on)
http://gcc.gnu.org/wiki/GFortranBinaries#MacOS.

I tried to compile a short program:

program test1
implicit none
character(len=*), parameter :: HELLO = " Hello, World!"
integer :: i
do i=1,22
write(unit=*,fmt=*) HELLO
end do
stop
end program test

bash-3.2$ gfortran -v -Wall test1.f95
Driving: gfortran -mmacosx-version-min=10.5.6 -v -Wall test1.f95 -
lgfortranbegin -lgfortran -shared-libgcc
Using built-in specs.
Target: i386-apple-darwin8.10.1
Configured with: /tmp/gfortran-20090321/ibin/../gcc/configure --
prefix=/usr/local/gfortran --enable-languages=c,fortran --with-gmp=/
tmp/gfortran-20
090321/gfortran_libs --enable-bootstrap
Thread model: posix
gcc version 4.4.0 20090321 (experimental) [trunk revision 144983]
(GCC)
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.5.6' '-v' '-Wall' '-
shared-libgcc' '-mtune=generic'
/usr/local/gfortran/libexec/gcc/i386-apple-darwin8.10.1/4.4.0/f951
test1.f95 -fPIC -quiet -dumpbase test1.f95 -mmacosx-version-min=10.5.6
-mtune=g
eneric -auxbase test1 -Wall -version -fintrinsic-modules-path /usr/
local/gfortran/lib/gcc/i386-apple-darwin8.10.1/4.4.0/finclude -o /var/
folders/GE
/GEWYOpehHqOgtylqy644TE+++TI/-Tmp-//ccPwIHdK.s
GNU Fortran (GCC) version 4.4.0 20090321 (experimental) [trunk
revision 144983] (i386-apple-darwin8.10.1)
compiled by GNU C version 4.4.0 20090321 (experimental) [trunk
revision 144983], GMP version 4.2.2, MPFR version 2.3.1.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-
heapsize=4096
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.5.6' '-v' '-Wall' '-
shared-libgcc' '-mtune=generic'
as -arch i386 -force_cpusubtype_ALL -o /var/folders/GE/
GEWYOpehHqOgtylqy644TE+++TI/-Tmp-//cct2l89c.o /var/folders/GE/
GEWYOpehHqOgtylqy644TE+++TI/-
Tmp-//ccPwIHdK.s
COMPILER_PATH=/usr/local/gfortran/libexec/gcc/i386-apple-
darwin8.10.1/4.4.0/:/usr/local/gfortran/libexec/gcc/i386-apple-
darwin8.10.1/4.4.0/:/usr/lo
cal/gfortran/libexec/gcc/i386-apple-darwin8.10.1/:/usr/local/gfortran/
lib/gcc/i386-apple-darwin8.10.1/4.4.0/:/usr/local/gfortran/lib/gcc/
i386-apple
-darwin8.10.1/
LIBRARY_PATH=/usr/local/gfortran/lib/gcc/i386-apple-
darwin8.10.1/4.4.0/:/usr/local/gfortran/lib/gcc/i386-apple-
darwin8.10.1/4.4.0/../../../:/usr/li
b/
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.5.6' '-v' '-Wall' '-
shared-libgcc' '-mtune=generic'
/usr/local/gfortran/libexec/gcc/i386-apple-darwin8.10.1/4.4.0/
collect2 -dynamic -arch i386 -macosx_version_min 10.5.6 -
weak_reference_mismatches n
on-weak -o a.out -lcrt1.10.5.o -L/usr/local/gfortran/lib/gcc/i386-
apple-darwin8.10.1/4.4.0 -L/usr/local/gfortran/lib/gcc/i386-apple-
darwin8.10.1/4.
4.0/../../.. /var/folders/GE/GEWYOpehHqOgtylqy644TE+++TI/-Tmp-//
cct2l89c.o -lgfortranbegin -lgfortran -lgcc_s.10.5 -lgcc -lSystem
/usr/bin/ld: warning unknown -macosx_version_min parameter value:
10.5.6 ignored (using 10.4)
/usr/bin/ld: /usr/lib/libSystem.dylib unknown flags (type) of section
6 (__TEXT,__literal16) in load command 0
/usr/bin/ld: /usr/lib/libSystem.B.dylib unknown flags (type) of
section 6 (__TEXT,__literal16) in load command 0
collect2: ld returned 1 exit status
bash-3.2$

db

unread,
May 19, 2009, 10:39:26 PM5/19/09
to GNU Fortran
Try compiling with:

gfortran -o test -Wall test.f95

that is, leave out the -v. I believe -v is used on its own to give
version information. I also put six spaces at the beginning of each
line (old fortran code style). There is probably a flag that lets you
leave out the spaces.

I hope this helps.

On Apr 15, 6:23 am, jon <jon_...@msn.com> wrote:
> Mac with macosx 10.5.6 Build 9G55 (gfortran version stuff below).
> Gfortran will not compile any code. I'm at a dead end trying to figure
> this out. Any help would be greatly appreciated.
>
> I downloaded and installed gfortran from (and as instructed on)http://gcc.gnu.org/wiki/GFortranBinaries#MacOS.

db

unread,
May 19, 2009, 10:45:22 PM5/19/09
to GNU Fortran
OK, using the .f95 extension means you don't need the spaces at the
beginning of each line.

fort jon

unread,
May 21, 2009, 10:15:16 PM5/21/09
to GNU Fortran


On May 19, 8:39 pm, db <da...@boomer.org> wrote:
> Try compiling with:
>
> gfortran -o test -Wall test.f95
>
> that is, leave out the -v. I believe -v is used on its own to give
> version information. I also put six spaces at the beginning of each
> line (old fortran code style). There is probably a flag that lets you
> leave out the spaces.
>
> I hope this helps.
>
Well, I put the -v in to let us see the version number. But with the
above suggestion, no output named test is produced: (hmm, does the
fact that the last line of the program does not terminate with a
newline be the cause of the problem?)

bash-3.2$ ls
hw.f90 hw.o hw.s mpiSim
project1 test1.f95
bash-3.2$ cat test1.f95
program test1
implicit none
character(len=*), parameter :: HELLO = " Hello, World!"
integer :: i
do i=1,22
write(unit=*,fmt=*) HELLO
end do
stop
end program test1bash-3.2$
bash-3.2$ gfortran -o test -Wall test1.f95
/usr/bin/ld: warning unknown -macosx_version_min parameter value:
10.5.7 ignored (using 10.4)
/usr/bin/ld: /usr/lib/libSystem.dylib unknown flags (type) of section
6 (__TEXT,__literal16) in load command 0
/usr/bin/ld: /usr/lib/libSystem.B.dylib unknown flags (type) of
section 6 (__TEXT,__literal16) in load command 0
collect2: ld returned 1 exit status
bash-3.2$ ls
hw.f90 hw.o hw.s mpiSim
project1 test1.f95
bash-3.2$

fort jon

unread,
May 21, 2009, 10:26:55 PM5/21/09
to GNU Fortran
I wondered:

(hmm, does the fact that the last line of the program does not
terminate with a newline be the cause of the problem?)

and apparently it does not. I added the newline and still no joy:

bash-3.2$ cat test1.f95
program test1
implicit none
character(len=*), parameter :: HELLO = " Hello, World!"
integer :: i
do i=1,22
write(unit=*,fmt=*) HELLO
end do
stop
end program test1
bash-3.2$ gfortran -o test -Wall test1.f95
/usr/bin/ld: warning unknown -macosx_version_min parameter value:
10.5.7 ignored (using 10.4)
/usr/bin/ld: /usr/lib/libSystem.dylib unknown flags (type) of section
6 (__TEXT,__literal16) in load command 0
/usr/bin/ld: /usr/lib/libSystem.B.dylib unknown flags (type) of
section 6 (__TEXT,__literal16) in load command 0
collect2: ld returned 1 exit status
bash-3.2$ ls
hw.f90 hw.o hw.s mpiSim
project1 test1.f95
bash-3.2$

I see that the os version number parameter is ignored and tries to use
10.4 which I don't have.

What are the next two lines referring to? I don't have the
familiarity with gcc or gfortran to understand this. I'm hoping it
could give someone a hint about what the problem is. But I'm a humble
programmer and even with my 44 years experience those lines leave me
clueless (not unusual some would say ;^).

Thanks to anyone who can help.

--
Jon

db

unread,
May 22, 2009, 10:51:18 AM5/22/09
to GNU Fortran
The newline can help at times. I've found issues with data files with
missing ending newlines...

However, I've just tried your program again and I'm getting an error:

gfortran: error trying to exec 'as': execvp: No such file or directory

I'm sure I got your program to compile before using the same compiler
version but it may have been on my home computer. I downloaded the
compiler from:

http://quatramaran.ens.fr/~coudert/gfortran/gfortran-macosx-x86.dmg

from http://gcc.gnu.org/wiki/GFortranBinaries

again and got the same error, no as??

No help yet.

gfortran -v
Using built-in specs.
Target: i386-apple-darwin8.10.1
Configured with: /tmp/gfortran-20090321/ibin/../gcc/configure --
prefix=/usr/local/gfortran --enable-languages=c,fortran --with-gmp=/
tmp/gfortran-20090321/gfortran_libs --enable-bootstrap
Thread model: posix
gcc version 4.4.0 20090321 (experimental) [trunk revision 144983]
(GCC)

David

P.S. I'm using tcsh but bash didn't seem to help.

db

unread,
May 22, 2009, 7:30:38 PM5/22/09
to GNU Fortran
OK, it works at home. I may have an old installation on XCode at work.

Do you have the latest gcc?

David

On May 22, 9:51 am, db <da...@boomer.org> wrote:
> The newline can help at times. I've found issues with data files with
> missing ending newlines...
>
> However, I've just tried your program again and I'm getting an error:
>
> gfortran: error trying to exec 'as': execvp: No such file or directory
>
> I'm sure I got your program to compile before using the same compiler
> version but it may have been on my home computer. I downloaded the
> compiler from:
>
> http://quatramaran.ens.fr/~coudert/gfortran/gfortran-macosx-x86.dmg
>
> fromhttp://gcc.gnu.org/wiki/GFortranBinaries

fort jon

unread,
May 24, 2009, 11:33:25 PM5/24/09
to GNU Fortran

On May 22, 5:30 pm, db <da...@boomer.org> wrote:
> OK, it works at home. I may have an old installation on XCode at work.
>
> Do you have the latest gcc?
>

Hmm. Nor sure. I dl'd and installed the gfortran. Do I need to
install more than what was provided by gfortran? If so, it would help
to have some documentation, somewhere, that would attend to this.

Any help is appreciated.

db

unread,
May 25, 2009, 10:31:52 AM5/25/09
to GNU Fortran
On the Mac the gfortran install assumes gcc or XCode (including gcc)
is already installed.

I think XCode is an optional install. Check your install disk/dvd. You
can join as a developer, there is a free level of membership that
gives you access to more up to date versions of XCode but the one on
the install disk should be enough.

Check to see if you have a /Developer directory. XCode is in /
Developer/Applications

David

fort jon

unread,
May 25, 2009, 2:25:18 PM5/25/09
to GNU Fortran

On May 25, 8:31 am, db <da...@boomer.org> wrote:
> On the Mac the gfortran install assumes gcc or XCode (including gcc)
> is already installed.
>

Thank you Thank you for the help. I had installed XCode for Tiger.
When I upgraded to Leopard, that got cleaned out. I am installing it
now and hope this resolves the problem.

jon

fort jon

unread,
May 25, 2009, 6:05:39 PM5/25/09
to GNU Fortran


On May 25, 8:31 am, db <da...@boomer.org> wrote:

> Check to see if you have a /Developer directory. XCode is in /
> Developer/Applications
>

That indeed was it. Now gfortran works again!

Thank you again.

--
jon
Reply all
Reply to author
Forward
0 new messages