'Undefined Symbols' problem with Xcode 2.3. Any ideas, please!!

scratt
Unregistered
 
Post: #1
I am having real problems getting some of my code to Link properly with the new Xcode...

It used to be fine with 2.2, and initially still builds fine with 2.3, but I am getting undefined labels which are expected in frameworks like Core Services and the like. This is the moment it gets to the linking stage..

I have tried various settings, and using different SDKs, but no joy.

Sometimes this can be because of a missed bracket or something in the source, or some other obscure error on my part. But I have gone back and used a backup which worked with 2.2 and get the same errors with 2.3.

Has anyone got a good source for trying to eliminate these problems, or any guesses (ANY!) as to what might be going on.. I have very little hair left this morning!

EDIT - I have already checked for borked imports and includes. No joy!

Code:
/usr/bin/ld: Undefined symbols:
_CGRectCreate referenced from AppKit expected to be defined in ApplicationServices
_CoreDockCancelNotification referenced from AppKit expected to be defined in ApplicationServices
_CoreDockNotify referenced from AppKit expected to be defined in ApplicationServices
_CoreDockRegisterClient referenced from AppKit expected to be defined in ApplicationServices
_CoreDockWaitForTransitions referenced from AppKit expected to be defined in ApplicationServices
_CFReadStreamCreateWithFTPRequest referenced from Foundation expected to be defined in CFNetwork
_kCFStreamPropertyFTPProxyServerName referenced from Foundation expected to be defined in CFNetwork
_kCFStreamPropertyFTPProxyServerPortNumber referenced from Foundation expected to be defined in CFNetwork
_CFLocaleCreateCanonicalLanguageIdentifierFromString referenced from CarbonCore expected to be defined in CoreFoundation
_CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes referenced from CarbonCore expected to be defined in CoreFoundation
_CFLocaleCreateCanonicalLocaleIdentifierFromString referenced from CarbonCore expected to be defined in CoreFoundation
_CFLocaleCreateComponentsFromLocaleIdentifier referenced from CarbonCore expected to be defined in CoreFoundation
_CFNotificationCenterPostNotificationWithOptions referenced from CarbonCore expected to be defined in CoreFoundation
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
Wow, do any of your applications work?! It looks like your system is hosed Smile

Post the entire link command from the detailed build log.
Quote this message in a reply
scratt
Unregistered
 
Post: #3
OneSadCookie Wrote:Wow, do any of your applications work?! It looks like your system is hosed Smile

Oh, that it were that simple! Wink

OneSadCookie Wrote:Post the entire link command from the detailed build log.

Code:
Building target “Arc” of project “arc” with configuration “Development”

Checking Dependencies
Ld /Users/stephennorthcott/Desktop/arc_OSX17inchProb/arc/macosx/build/Development/arc.app/Contents/MacOS/arc normal ppc
    cd /Users/stephennorthcott/Desktop/arc_OSX17inchProb/arc/macosx
    /usr/bin/g++-4.0 -o /Users/stephennorthcott/Desktop/arc_OSX17inchProb/arc/macosx/build/Development/arc.app/Contents/MacOS/arc -L/Users/stephennorthcott/Desktop/arc_OSX17inchProb/arc/macosx/build/Development -LFrameworks -F/Users/stephennorthcott/Desktop/arc_OSX17inchProb/arc/macosx/build/Development -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks -F/Volumes/WorkspaceArchive/uDEVELOPEMENT/OSG_OP_OT-1.0/Producer/Xcode/Producer/build/Development -F/Volumes/WorkspaceArchive/uDEVELOPEMENT/OSG_OP_OT-1.0/OpenThreads/Xcode/OpenThreads/build/Development -F/Volumes/WorkspaceArchive/uDEVELOPEMENT/OSG_OP_OT-1.0/OpenSceneGraph/Xcode/OpenSceneGraph/build/Development -filelist /Users/stephennorthcott/Desktop/arc_OSX17inchProb/arc/macosx/build/arc.build/Development/arc.build/Objects-normal/ppc/arc.LinkFileList -framework Cocoa -framework OpenGL -lpng -lpng -llua -llualib -framework Carbon -framework CoreServices -framework ApplicationServices -framework AppKit -framework Foundation -framework Producer -framework OpenThreads -framework osg -framework osgDB -framework osgFX -framework osgGA -framework osgIntrospection -framework osgParticle -framework osgProducer -framework osgSim -framework osgText -framework osgUtil -arch ppc -pg -Wl,-Y,1455
/usr/bin/ld: Undefined symbols:
_CGRectCreate referenced from AppKit expected to be defined in ApplicationServices
_CoreDockCancelNotification referenced from AppKit expected to be defined in ApplicationServices
_CoreDockNotify referenced from AppKit expected to be defined in ApplicationServices
_CoreDockRegisterClient referenced from AppKit expected to be defined in ApplicationServices
_CoreDockWaitForTransitions referenced from AppKit expected to be defined in ApplicationServices
_CFReadStreamCreateWithFTPRequest referenced from Foundation expected to be defined in CFNetwork
_CFURLCopyComponents referenced from Foundation expected to be defined in CoreFoundation
_CFURLCreateFromComponents referenced from Foundation expected to be defined in CoreFoundation
__CFNotificationCenterAddObserver referenced from Foundation expected to be defined in CoreFoundation
__CFNotificationCenterCountObservers referenced from Foundation expected to be defined in CoreFoundation
__CFNotificationCenterCreate referenced from Foundation expected to be defined in CoreFoundation
__CFNotificationCenterExtraData referenced from Foundation expected to be defined in CoreFoundation
__CFNotificationCenterPostNotification referenced from Foundation expected to be defined in CoreFoundation
__CFNotificationCenterSetExtraData referenced from Foundation expected to be defined in CoreFoundation
__CFNotificationCenterSetSerializeRemoves referenced from Foundation expected to be defined in CoreFoundation
_kCFStreamPropertyFTPProxyServerName referenced from Foundation expected to be defined in CFNetwork
_kCFStreamPropertyFTPProxyServerPortNumber referenced from Foundation expected to be defined in CFNetwork
_CTFontCopyCharacterSet referenced from HIToolbox expected to be defined in ApplicationServices
_CTFontCreateVariantWithMatchingSymbolicTraits referenced from HIToolbox expected to be defined in ApplicationServices
_CTFontCreateWithGraphicsFont referenced from HIToolbox expected to be defined in ApplicationServices
_CTFontCreateWithPlatformFont referenced from HIToolbox expected to be defined in ApplicationServices
_CTLineCreateJustifiedLine referenced from HIToolbox expected to be defined in ApplicationServices
_CTLineCreateTruncatedLine referenced from HIToolbox expected to be defined in ApplicationServices
_CTLineCreateTruncatedLineWithTokenCallback referenced from HIToolbox expected to be defined in ApplicationServices
_CTLineCreateWithAttributedString referenced from HIToolbox expected to be defined in ApplicationServices
_CTLineDraw referenced from HIToolbox expected to be defined in ApplicationServices
_CTLineGetPenOffsetForFlush referenced from HIToolbox expected to be defined in ApplicationServices
_CTLineGetTypographicBounds referenced from HIToolbox expected to be defined in ApplicationServices
_CTTypesetterCreateLine referenced from HIToolbox expected to be defined in ApplicationServices
_CTTypesetterCreateWithAttributedString referenced from HIToolbox expected to be defined in ApplicationServices
_CTTypesetterSuggestLineBreak referenced from HIToolbox expected to be defined in ApplicationServices
_MDSchemaCopyAttributesForContentType referenced from HIToolbox expected to be defined in ApplicationServices
_MDSchemaCopyDisplayNameForAttribute referenced from HIToolbox expected to be defined in ApplicationServices
_kCTFontAttributeName referenced from HIToolbox expected to be defined in ApplicationServices
_kCTForegroundColorFromContextAttributeName referenced from HIToolbox expected to be defined in ApplicationServices
_kCTKernAttributeName referenced from HIToolbox expected to be defined in ApplicationServices
_kCTUnderlineStyleAttributeName referenced from HIToolbox expected to be defined in ApplicationServices
_kMDAttributePreviewValues referenced from HIToolbox expected to be defined in ApplicationServices
_kMDItemDurationSeconds referenced from HIToolbox expected to be defined in ApplicationServices
_kMDItemLastUsedDate referenced from HIToolbox expected to be defined in ApplicationServices
_kMDItemPageHeight referenced from HIToolbox expected to be defined in ApplicationServices
_kMDItemPixelHeight referenced from HIToolbox expected to be defined in ApplicationServices
_kMDItemResolutionHeightDPI referenced from HIToolbox expected to be defined in ApplicationServices
__MDItemMarkAsUsedWithPathAndCatInfo referenced from LaunchServices expected to be defined in CoreServices
collect2: ld returned 1 exit status

...enjoy... (And, seriously. Thanks for any help!)
Grin
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #4
That link command looks fairly normal. A couple of things that might cause problems --

You're using the 10.2.8 SDK, which Apple no longer recommends -- perhaps they inadvertently broke it, or perhaps you didn't update it when you updated the rest of Xcode. Does your app work with the 10.3.9 SDK?

it's passing -F (search for frameworks in) a few nonstandard directories. If any frameworks in those directories have the same names as system frameworks, that might cause issues.

You're linking a peculiar collection of frameworks, and their names are in a peculiar order -- it might be worthwhile messing with that set, and the order they're in, though I didn't think that made a difference.
Quote this message in a reply
scratt
Unregistered
 
Post: #5
Thanks for the feedback..

I have indeed tried using different SDKs. Same result as I remember. Some just caused so many problems it was untrue.. I will go back and double check that. I am not that comfortable with linking commands, and have to admit that I noticed the 10.2.8s in there, when I am actually developing with the 'Use Current OS' option. My OS is always as up to date as Apple's releases. Can you explain why that is in there when I have not chosen it as an option, as far as I am aware...

I will check the -F statements and tidy them up.

The 'strange' Frameworks I am using are from Open Scene Graph. A really nice OS X compatible (multi-platform) Scene Graph engine. It is very rigorously maintained and I have not had any clashes with it to date, and would be suprised if there were any as the V1.0 I am using is very stable, as well as being part of an active developement movement who would have flagged any problems real quick.
Quote this message in a reply
Moderator
Posts: 508
Joined: 2002.09
Post: #6
Sometimes doing a "Clean All" command works miracles.

"When you dream, there are no rules..."
Quote this message in a reply
scratt
Unregistered
 
Post: #7
Thanks to everyone for the input.

I think I'll stick around a bit here and see where I can help out too.
It's really nice to have an active group to bounce ideas off.

I actually solved the problem by using a lateral solution..
The core app that a lot of my project is based around has been updated (it's Open Source) so I stripped out the diffs between the updated source and my current version, and then moved those accross to the updated core.

I then added back in all of my files (derived classes and so on) one by one and found that by the time it came to build and execute the thing it was working again!

So I kind of used the time I was going to use on updating to clear out the issue that Xcode had with the source somewhere... No idea where.

The downside is it could come back and I have no solution.
The upside is I have an even more stable and feature laden base to build my project on, and it builds again!
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Need help with undefined symbols error with Univeral app running under 10.3.9 dmdmdm 0 2,094 May 29, 2009 01:16 PM
Last Post: dmdmdm
  xcode build problem NelsonMandella 7 5,367 Apr 13, 2009 12:21 PM
Last Post: szymczyk
  Error with Linking Symbols Oddity007 1 2,588 Feb 24, 2009 06:20 PM
Last Post: Oddity007
  Newbie problem XCode Include files BBBert 1 4,144 Mar 17, 2008 03:46 PM
Last Post: OneSadCookie
  SDL_mixer problem in XCode mt_maui 3 3,465 Nov 14, 2006 10:37 AM
Last Post: savage