Welcome to MacForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

How to get gcc and g77 to work together

 
   Macintosh computer (Home) -> System RSS
Next:  what is this error?  
Author Message
Charles

External


Since: Mar 02, 2005
Posts: 5



(Msg. 1) Posted: Wed Mar 02, 2005 8:58 pm
Post subject: How to get gcc and g77 to work together
Archived from groups: comp>sys>mac>system (more info?)

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.

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
(using g77, that's always been the best way to link C and Fortran, let
Fortran deal with Fortran's problems) with messages like this:

/usr/bin/ld: yesno.o section's (__TEXT,__eh_frame) type S_REGULAR does
not match previous objects type S_COALESCED

It looks like I get that for every Fortran object. I've also tried
using version 3.4.2 of g77 (which I thought was supposed to fix this
problem), but it doesn't help; I get the same error messages about
section type mismatch between S_REGULAR and S_COALESCED. (I do that
still using the 3.3 version of gcc.)

Do I need a later version of gcc itself? If so, where do I get that?

Charles Peterson

 >> Stay informed about: How to get gcc and g77 to work together 
Back to top
Login to vote
Charles

External


Since: Mar 02, 2005
Posts: 5



(Msg. 2) Posted: Wed Mar 02, 2005 9:08 pm
Post subject: Re: How to get gcc and g77 to work together [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I now see that Apple also suggests going back to gcc version 3.1, but
that's a complete non-starter because the 3.1 gcc crashes with a
segmentation fault compiling my code:

gcc -O3 -I../lib -DUSE_SAFELIB -fexceptions -I../lib -O3 -DUSE_SAFELIB
-fexceptions -c -o eigstruc.o eigstruc.c
gcc: Internal error: Segmentation fault (program
/usr/libexec/gcc/darwin/ppc/cpp-precomp)
Please submit a full bug report.
See <URL:http://developer.apple.com/bugreporter> for instructions.

Charles

 >> Stay informed about: How to get gcc and g77 to work together 
Back to top
Login to vote
twhall

External


Since: Dec 05, 2004
Posts: 4



(Msg. 3) Posted: Fri Mar 04, 2005 1:46 pm
Post subject: Re: How to get gcc and g77 to work together [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Will OS 9.2 work in a 7100? - I own a Power Mac 7100/80 that has been upgraded with a Sonnet G3 266 MHz Upgrade Card. I am presently running OS 9.1. Could I easily upgrade it to OS 9.2? Thanks in advance for your help.

I cannot get the AIRPORT to work with other PC's - I can access the Internet via the Airport (Wireless) with my iBook. But when I tried to connect my PC (running Red Hat Linux)to the other available port on the Airport I cannot get the PC to see the Internet. Then, I went to AirPort Admin Utility to giv...

Command+5 won't work [10.3.2] - I noticed some timer ago that command+5 stop working for me. Strangely it is recognized as command+c (that is, it copies text). I tried two keyboards with the same result, so it is not a hardware problem. This is Mac OSX 10.3.2. Thanks in advance

DVD Player Doesn't Work - I've been unable to use Apple's DVD Player app for almost a year now. I've seen a couple of threads on this group concerning DVD Player crashes on startup but nothing that seems to pertain to my situation. I'm from DVD zone 2. Played numerous DVDs..

Can't get Classic to work - I have a 500 MHz iMac, 384 MB RAM, with OS 10.3 and I can't get Classic to work on it. When I try to use an old app that wants classic, I get a message that the system can't find the OS9 folder. When I open the OSX System Preferences and click the ico...
   Macintosh computer (Home) -> System All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]