linker warnings: multiple definitions libSystem.dylib vs libmx.dylib: Solved -- but ?!?!
linker warnings: multiple definitions libSystem.dylib vs libmx.dylib: Solved -- but ?!?!
- Subject: linker warnings: multiple definitions libSystem.dylib vs libmx.dylib: Solved -- but ?!?!
- From: Kirk Kerekes <email@hidden>
- Date: Thu, 5 May 2005 12:55:22 -0500
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:
This email sent to email@hidden