Skip to main content

Building software for a MAC

Owners of Apple MACs are always keen to tell you how wonderful their macs are, and how awful PCs are. They are usually people who have not had to build software for a MAC platform, because unless you are writing a simple command line problem this appears to be a complete nightmare.

A major problem is the lack of easily available documentation. Whereas Microsoft have provided extensive and detailed documentation http://msdn.microsoft.com/en-gb/default.aspx trying to find documentation for the mac usually results in you going around in circles.

Problems with the 'Carbon' library

For example, following the links on the (slow) web page

http://developer.apple.com/Carbon/

does not take you to any kind of systematic documentation on the carbon library.

What you usually end up with is a page where someone else has had the same problem as you, and not found an answer

http://lists.apple.com/archives/Carbon-dev/2007/Jul/msg00304.html

http://lists.apple.com/archives/carbon-development/2002/Nov/msg00197.html

being wonderful examples.

In my case, I was trying to compile some code, which turned out to be linked to the carbon library, except that the error message that I got back on linking was:

/usr/bin/ld: Undefined symbols:
_ATSFontFindFromName
_ATSFontGetFileSpecification
_CFRelease
_CFStringCreateWithCString
_CloseResFile
_FSCompareFSRefs
_FSGetCatalogInfo
_FSGetForkCBInfo
_FSOpenResFile
...

after many fruitless hours searching on the web and code hacking I discovered that I needed

-framework Carbon

as one of the command paramaters when linking, which I found out about at http://forum.soft32.com/mac/Carbon-Carbon-ftopict42236.html

a search on Google shows that this magic peice of information does not show up on any systematic documentation from Apple.

Failing to find symbols when building a release version of code

Another problem that I had was software where the debug version built and ran OK, but when linking the release version I got:

internal error: output_local_symbols() inconsistent local symbol count

and no level of additional warning information provided more information.