image
image
Ticket Options
Question Details
TICKET ARCHIVE -> Ld: Undefined Symbols Error With G77 On Osx 10.3.9
ukdonna - Jul 22, 2005 - 5:03 am
image
image
Hello...

I'm trying to compile a old code using a make file originally intended for HP, and I've successfully compiled it on several other Unix platforms before (SUN and Solaris). I'm now trying to compile this on my Mac (osx 10.3.9), and I'm getting the following error:

g77 -g -e -c inv1d.f
/usr/bin/ld: Undefined symbols:
_main
_c_abs
_c_exp
_conjug_

etc, etc, etc

/usr/bin/ld: entry point symbol name: -c not defined
collect2: ld returned 1 exit status
make: *** [inv1d.o] Error 1

So.... some of the things in the "undefined symbols" list are other subroutines the main code is linking too.

Obviously, it doesn't like the -c option (what should I use with g77 instead to make just .o files?). I've added a -lgcc to the command that is creating all the *.o files, then things work a little better. It now makes the .o files, but complains later:

g77 -g -e -lgcc -c inv1d.f
g77 -g -e lgcc -c conjug.f

etc, etc, etc

/usr/bin/ld: Undefined symbols:
_MAIN__
/usr/bin/ld: entry point symbol name: inv1d.o not defined
collect2: ld returned 1 exit status

Ergh! I'm really out of my league with this sort of thing, so I'm not sure what to do next. Any ideas? It seems like I just need another flag somewhere during the linking step, and everything would be fine....

Thanks!
Donna

macbri - Jul 22, 2005 - 7:24 am
image
image
Hi Donna -

I've done a bit of work porting old unix code to Mac OS X. First thing I'd suggest is modifying your Makefile so that the arguments for g77 become:

-g -ffixed-line-length-132

instead of

-g -e

(-e on Solaris anyway implies extended source line support, i.e. allow fortan lines longer than 72 characters).

See if that helps and let me know how it goes!
--------
Brian S.
MacOSX.com Technical Support
brian@macosx.com
ukdonna - Jul 22, 2005 - 7:51 am
image
image
Brian S,

You're my hero! That fixed the problem perfectly! I just knew there had to be an "easy" solution, and you had it! I'll remember to make this substitution in the future....

Thank you thank you thankyou!

Donna
macbri - Jul 22, 2005 - 7:53 am
image
image
Glad to help - thanks for using macosx.com!

--------
Brian S.
MacOSX.com Technical Support
brian@macosx.com

IF THIS IS YOUR QUESTION AND YOU WISH TO RESPOND, LOGIN HERE FIRST.


Search Engine Optimization by vBSEO 3.3.0 RC1