Re: linker warnings: multiple definitions libSystem.dylib vs libmx.dylib: Solved -- but ?!?!
Re: linker warnings: multiple definitions libSystem.dylib vs libmx.dylib: Solved -- but ?!?!
- Subject: Re: linker warnings: multiple definitions libSystem.dylib vs libmx.dylib: Solved -- but ?!?!
- From: Rick Hoge <email@hidden>
- Date: Thu, 5 May 2005 14:14:25 -0400
Thanks again for this post - just adding -lSystem as "other linker
flag" got rid of 197 warnings...
On May 5, 2005, at 1:55 PM, Kirk Kerekes wrote:
I am trying to build a project that built fine under previous
versions of XCode (yada, yada) but now I get a collection of linker
multiple-definition warnings for math functions. Rather than fight
it in the original project which is rather large and complex, I
have a test project that duplicates the problem by simply linking
in the Cocoa and Accelerate frameworks and making a single call to
sqrtf().
It appears (based on fooling around with the -whyload flag) that
libSystem and libmx both contain definitions of numerous math
functions, but unfortunately when _I_ invoke sqrtf, libmx is
loaded, and when the Accelerate framework references some arbitrary
math function, the math module of libSystem is loaded, generating
the duplicate symbol warnings.
On a hunch, I tried adding an explicit reference to
libSystem.dylib, both by using the "add to project" method and by
using "-lSystem" in the target's Other Linker Flags (but not both
at once). In both cases, all of the duplicate symbol message
magically vanished.
So why are you reading this?
While this problem is thus sort-of solved, I am not particularly
satisfied with the solution. The core problem appears to be that
libmx gets searched before libSystem does, simply because it alpha-
sorts first. This would appear to be an undesirable behavior, prone
to wasting hours of developer-time. It would seem to me that there
should be an implicit -lSystem in any Cocoa application project,
since even an empty Cocoa app project makes a bajillion references
to libSystem.dylib.
But there also should be some sort of mechanism in XCode to detect
and manage this kind of issue.
Yeah, I'm going to submit this as a bug, but I thought this might
help someone out there.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40nmr.mgh.harvard.edu
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden