Small. Fast. Reliable.
Choose any three.
This page is about building sqlite for MacOS using CodeWarrior. The MacOS port was added as of ticket #218 (which includes the modified files, if you are reading this before the port has made it into the release).

If you are building for OS X (Darwin), use Apple's tools (gcc) and treat it as Unix.

Note: I use version 8 of CodeWarrior. I haven't tried this with earlier versions.

On MacOS, you will be concerned with two types of build: Classic and Carbon. I use Classic for maximum backwards compatibility and Carbon for MacOS 9.1 (9.2.2 recommended) or newer with CarbonLib 1.5 or newer. The Carbon build runs natively on OS X. If you are a seasoned Mac developer you will know all this.

You can select the various build options using a prefix file (under C/C++ Language settings). This is to do the equivalent of the -D command line options for most other compilers.

For Classic I build without large file support and without thread support. So, the prefix file contains:

#define SQLITE_DISABLE_LFS

For Carbon I build with large file and thread support. Note that a 'thread' to Apple is not the same as a thread to everyone else. Apple uses the term 'multitasking' or (worse still) 'multiprocessing' when it refers to pre-emptively scheduled threads. So the prefix file contains:

#define THREADSAFE 1

The other important thing to remember when making a Carbon executable is to include carb.r in your project (e.g. from MacOS Support/PowerPlant/PowerPlant Resources/carb.r)

The command line 'sqlite' utility builds using SIOUX. For this you need all the files except tclsqlite.c. You can build the TCL library as a separate exercise, but you will need to put tcl.h in your Access Paths (under User Paths). Note that, when you use this utility, any relative path names you give it are relative to the directory containing the executable, and you will need to use Mac paths (using colons), even with the Carbon build running under OS X.

The libraries you will need for the Classic build are:

The libraries you will need for the Carbon build are:

All these (except the standard .libs) are under MacOS Support/Universal/Libraries, and then under PPCLibraries and StubLibraries. The standard libraries are under MSL/MSL_C//MSL_MacOS/Lib/PPC.

A couple of other settings I do:

  1. On PPC Target, Creator, I put SQLI. (I'm not sure if that's the correct thing to do, but files created by sqlite, have this as the creator and 'Document' as type')
  2. On PPC Processor, I put Struct Alignment as PowerPC, Target Processor as Generic PowerPC and Function alignment as 4.
  3. If you are building a shared library, on PPC linker, remove __start from Main (Entry Points). Also don't include shell.c in the build.
  4. On PPC PEF I set the fragment name to sqlite, or tclsqlite if I am building for TCL.

I hope this works for you. If you find out anything else useful, add it to this page.