Charles wrote:
> I'm trying to build a large program written in C++, C, and Fortran
> compiled on OS X. Been doing this on Linux, Solaris, and Solaris x86
> using gcc and g77 for many years. But on the Mac, there are peculiar
> problems, starting from the fact that the g77 and gcc do not come as a
> tightly coupled pair, but gcc comes from Apple while g77 comes from
> Fink.
Yes, that's a pain. It would be trivial for Apple to include the g77
front end in their gcc distribution; I wish they would do so.
In my case, I finally downloaded the gcc 3.3 source and compiled the
whole package myself.
> I've tried several different version combinations of the two. Nothing
> so far works. The obvious choice of using versions 3.3 of both. That
> can be done if occurrances of "STOP" within the Fortran are replaced
> with CALL EXIT (1). But then, it all blows apart during the final link
There's an annoying bug in g77 3.3 (that I've been told is fixed in 3.4)
regarding simple STOP statements that fail to assemble. I've discovered
that I can avoid the bug by appending the STOP with an INTEGER or CHARACTER
constant -- for example:
STOP 0
STOP 'Normal'
These both conform to ANSI X3.9-1978, 11.12
I compile C and FORTRAN source into separate ".o" files (using gcc and
g77, respectively), then link them using either gcc or g77, depending on
the language of the main program. Most often, I have a FORTRAN main
calling C, so I use g77 for the linking step. In a couple of cases where
I have a C main calling FORTRAN, I use gcc for linking, with -lg2c to
resolve some FORTRAN library symbols.
> /usr/bin/ld: yesno.o section's (__TEXT,__eh_frame) type S_REGULAR does
> not match previous objects type S_COALESCED
I don't recall ever seeing that. Maybe there's some inconsistency in
options you're passing to gcc and g77?
Here's some stuff from my Makefile:
F77 = /usr/local/bin/g77
FFLAGS = -c -O3 -I$(APRL)/src \
-fno-silent \
-fno-backslash \
-fno-ugly-assign \
-fno-ugly-assumed \
-fno-ugly-comma \
-fcase-upper \
-fdollar-ok \
-fbadu77-intrinsics-delete \
-ff2c-intrinsics-delete \
-ff90-intrinsics-delete \
-fgnu-intrinsics-delete \
-fmil-intrinsics-enable \
-funix-intrinsics-enable \
-fvxt-intrinsics-delete \
-ffixed-line-length-72 \
-Wsurprising \
-Wuninitialized \
-W \
-fno-f2c \
-fno-underscoring
CC = /usr/local/bin/gcc
CFLAGS = -c -O3 -I$(APRL)/src \
-ansi \
-std=c89 \
-fno-asm \
-fhosted \
-Wall \
-W \
-Wundef \
-Wpointer-arith \
-Wcast-qual \
-Wcast-align \
-Wwrite-strings \
-Wstrict-prototypes \
-Wmissing-prototypes \
-Wmissing-declarations
I had forgotten that my Makefile is using my own local gcc, which I built
along with my g77. I think I've also used Apple's gcc without trouble.
I tried to configure my g77 to be compatible with Apple's gcc distribution.
% which gcc
/usr/bin/gcc
% gcc -v
Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs
Thread model: posix
gcc version 3.3 20030304 (Apple Computer, Inc. build 1495)
% /usr/local/bin/gcc -v
Reading specs from /usr/local/lib/gcc-lib/powerpc-apple-darwin7.5.0/3.3/specs
Configured with: ../gcc/configure --enable-threads=posix
Thread model: posix
gcc version 3.3
% /usr/local/bin/g77 -v
Reading specs from /usr/local/lib/gcc-lib/powerpc-apple-darwin7.5.0/3.3/specs
Configured with: ../gcc/configure --enable-threads=posix
Thread model: posix
gcc version 3.3
Hope there's something helpful to you in all this.
--
Ted Hall<!-- ~MESSAGE_AFTER~ -->
>> Stay informed about: How to get gcc and g77 to work together