|
|
This
page is now obsolete. Please go instead to the wiki page (click on
the image below):

Install
gcc and other `developer tools' from Apple's
website or supplied CD or DVD:
If you have the
OS X 10.3 Xcode installation CD (the fourth disk that comes with
the package), or the Xcode 2.4 package on the OSX 10.4 installation
DVD (or the installer available from Apple's web site), be sure to
do all of the following:
1. Install everything, not
just the defaults.
2. Install the latest version of Xcode from Apple's
web site that is compatible with your operating system. For 10.4.x,
that is currently version 2.4. The download is about 900 MB, so you
might not want to use a dial-up connection. (For 10.3.x, I think it
is 1.5. But you should update your OS to 10.4.x.)
3. Do a "Custom install" and be sure to install the X11 SDK package
too, which installs all the header files and other such
things you will need to compile X11-based programs. (This is now
the default starting with version 2.0). You can also install this
after-the-fact either from the CD or as a download.
PLEASE
NOTE: Sometimes
Apple's X11SDK and X11 installers mess up and don't install
everything. This will wreak havoc on your attempts to get
fink to recognize X11.app. To avoid this pain, download Gary Kerbaugh's pkgdiff script
and run it according to the description linked
here.
|
Apple
makes a native c compiler that is based upon gcc. It
comes for free with the Apple X Code (Developer
Tools). For OS 10.4, you get gcc 4 and gcc
3.3. For OS 10.3, you get gcc 3.3 and gcc 3.1, and for OS
10.2, the gcc compiler versions are 3.1
and 3.3, tweaked a bit apparently for
the Mac operating system. (You also get a copy of version
2.95, and can switch between them if you need to.
man cc for details.) You
can either get it on the OS X distribution CDs that come with 10.3,
or you can get the December 2002 and August 2003 update for
10.2. which you can download it
from Apple's site . In order to do that, you have to
join their developer group, which is free but involves submitting a
tedious form, getting a username and password, etc. You
can spend a lot of time going in circles; this site is a pain to
navigate.
For 10.3.x, g77 v. 3.4.3 is the default fortran compiler that
comes with fink, and it can also be used with OS 10.4. OS 10.4
Xcode 2 provides the newer gfortran, but in my (limited) experience
g77 3.4.3 works better. In addition,you will need to use the
following complier flag syntax for Cocoa Frameworks and Apple's
Blas/Lapack now:
-Wl,-framework -Wl,vecLib
Also, you will now need to use
the following complier flag when linking fortran with gcc in
10.3.x, but not in 10.4:
-lcc_dynamic
I think I
have found all instances of where this is required, but be aware
that this is a ubiquitous problem.
Another option: the IBM C and
f77 compilers:
The only
thing I have compiled with these
compilers is CNS. I had some problems with over-zealous
optimization when I tried the free beta test versions, so be
careful.
Back
it up: To save yourself the pain of having to dowload the
Developer Tools and X-windows installers again, I suggest you burn
both sets of installer packages to a CD-RW. (The RW will
allow you to make more current backups when new releases render
your backup CD obsolete.) This will greatly facilitate restoration and
future installations on other machines .
Richard Stallman (aka St. Ignucious)
is the person who wrote gcc originally. He started the GNU Free
Software Foundation and is one of the original instigators of the
Free Software Movement, upon which everything here relies heavily
in practice even if violated in spirit. He has a webpage that may be of
interest, as he is not without an opinion or two.
In
addition:
There are several useful information resources that you might want
to take advantage of. These include:
1. Apple's Mailing
lists. They have many, but a few that might be of
specific interest are the Fortran
users list, the unix
porting list, the x-11
users list, and Science/technology
list. Be sure to adjust your mail filters accordingly if you
subscribe to these.
2. Apple's Technical Support Bulletin Boards. I've gotten a lot
of help here.
3. On-line
Documentation. Apple has really good
on-line documentation. I find it easier than most
third-party books, and this has the advantage of being up to date
and free. Be sure to check out the Cocoa programming
tutorials. Even an idiot like me can do this (although there
is a lot I cannot do). Developer tools also includes
HTML documentation that you can access locally (on your own
computer).
What's in Developer Tools (X
code):
From the unix perspective, the most important things in Developer
tools are the gCC compiler and ancillary stuff like make, gas,
etc. It also includes a bunch of other BSD stuff that you
would expect to be standard on any unix platform, so be sure to
install it even if you wind up using some other set of compilers
(unless those instructions tell you otherwise).
In addition, Apple provides for free its whole Project Builder and
Interface Builder application set. This allows any user to
construct native OS X applications. The "native" language for
doing this is called objective C, which is said to be a superset of
C. I'm not a programmer, and it strikes me as a bit
obtuse. You also have several other options including Carbon
(which I think is C-based but know nothing about), a "bridge" to
Java, so that you can write OS X Cocoa applications with Java
instead of Objective C, similarly with Perl, and a "bridge" to
AppleScript, which is an Apple-developed, supposedly user-friendly
but syntactically bloated and finicky language that allows you to
program many OS X applications. In addition, there is
a "bridge" to python,
called PyObjC, that is available via sourceforge from a
third-party. In analogy to the Java bridge, it allows you to
write the major coding portion of your program in python, which is the world's best
scripting language (which possesses the merit of having syntax that
doesn't suck), and then use all of the OS X developer tools to
apply a nice interface to it. There are now other possibilities too.
|