Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Link problems: restFP/saveFP and -lcc_dynamic -- why?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Link problems: restFP/saveFP and -lcc_dynamic -- why?



Norman Gray wrote:
Greetings,

Can anyone explain to me what the story is with the restFP/saveFP
symbols, which cause such inexplicable link problems with (some? all?)
combinations of g77 and gcc code? [I posted this query on
email@hidden a few days ago, but nobody wanted to bite].

For those as yet innocent of this, the problem is that in certain
circumstances, links fail because the restFP and saveFP symbols are
undefined. Do a little bit of Googling, and you'll soon come across
the advice to add -lcc_dynamic (or sometimes -lgcc, or even sometimes
libgcc.a) to the link options.

One thing you should make absolutely sure is that you don't have a stray libgcc.dylib in your linker search path, in /usr/local/lib or in your case somewhere in /opt/local/lib. Due to one of Apple's linker "features", dynamic libs take precedence over static libs, so the presence of libgcc.dylib will shadow gcc's libgcc.a that should be included all the time.

The -lcc_dynamic flag will pull in libgcc.a via a symlink, because nobody is likely to have a libcc_dynamic.dylib, whereas chances for a the existence of a spurious libgcc.dylib are bigger. Depending on how you compiled your g77, it will have produced one (does opendarwin do this? Fink doesn't, it compiles g77 with the --disable-shared configure option), or some other program will install it, because it has been compiled with a version of gcc that had one.

If your linker links to both libgcc.a (via -lcc_dynamic) and libgcc.dylib (via -lgcc), results are unpredictable, pretty much what you are observing.

--
Martin
_______________________________________________
fortran-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/fortran-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Link problems: restFP/saveFP and -lcc_dynamic -- why? (From: Norman Gray <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.