Chapter 4. Compiling Source Code

The Mac OS X Developer Tools are available from Apple and provide a development environment that will be familiar to any Unix developer whoworks with command-line compilers. For details about obtaining these tools, see the “Developer Tools” section in the Preface. The Developer Tools include all sorts of other goodies, including an advanced Integrated Development Environment (IDE), but coverage of those tools is beyond the scope and intent of this book. To learn more about the Developer Tools, you can see /Developer/Documentation/DeveloperTools/devtools.html. You can also learn how to use Project Builder and Interface Builder and how to program Cocoa applications with Objective-C in Learning Cocoa with Objective-C (O’Reilly) and Building Cocoa Applications: A Step-by-Step Guide (O’Reilly).

The C compiler that comes with the Developer Tools is based on the Free Software Foundation’s GNU Compiler Collection, or GCC. Apple’s modifications to GCC include the addition of Objective-C to the compiler suite, as well as various modifications to deal with the Darwin operating system. The development environment in Mac OS X includes:

AppleScript

This is an English-like language used to script applications and the operating system. AppleScript is installed as part of the Mac OS X operating system and does not require the Developer Tools package.

AppleScript Studio

This is a high-level development environment based on AppleScript that allows you to build GUI applications by hooking AppleScript into the Cocoa frameworks. AppleScript Studio is installed along with the Developer Tools package.

Compilers

These compilers are based on GCC and provide support for C, C++, Objective-C, Objective-C++, and assembly.

Compiler Tools

These include the Mac OS X Mach-O GNU-based assemblers, Mach-O static link editor, Mach-O dynamic link editor, and Mach-O object file tools, such as nm and otool.

Documentation

There is extensive documentation for the Apple Developer Tools (provided by Apple). Available in both HTML and PDF formats, the developer documentation can be found in /Developer/Documentation. The documents are also available online from the Apple Developer Connection (ADC) web site (http://connect.apple.com).

Tip

You can also access the documentation for GCC with your web browser by going to /Developer/Documentation/DeveloperTools/Compiler/CompilerTOC.html.

Debugger

The Apple debugger is based on GNU gdb.

Miscellaneous Tools

These include traditional development tools, such as GNU make and GNU libtool, graphical and command-line performance tools, Project Builder for WebObjects (Mac OS X Server), and an extensive set of Java development tools.

Project Builder

This is an integrated development environment for Mac OS X that supports Cocoa and Carbon programming with C, C++, Objective-C, and Java.

Interface Builder

This is a graphical user interface editor for Cocoa and Carbon applications.

We will not address the complete Mac OS X development suite in this chapter. Instead, we will focus on the command-line development tools and how they differ from the implementations on other Unix platforms.

Java programmers will find that the Mac OS X command-line Java tools (see Section 1.6.4) behave as they do under Unix and Linux.

Perl programmers coming from previous Macintosh systems will find that Mac OS X does not use MacPerl (http://www.macperl.com), but instead, uses the standard Unix build of the core Perl distribution (http://www.perl.org).

Get Mac OS X for Unix Geeks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.