Building on Mac OS X
Clone this wiki locally
Note: these instructions are for building on Intel systems. It should also be possible to build on PowerPC, but the various architecture flags will have to be modified.
Xcode Developer Tools
These are required in order to compile c10t and the supporting libraries.
- Available from http://developer.apple.com with a free Apple Developer account. Note: the iOS SDK is not required, you can search through the downloads list for a version with just Xcode (about 1 GB).
- Alternatively, there should be a copy of Xcode Tools on the Mac OS X install DVD or one of the system restore discs that came with your Mac.
- Xcode 3.1.4 is the last version that can be installed on Leopard (10.5) systems. It includes gcc 4.0.
- Xcode 3.2 and later can be installed on Snow Leopard (10.6) only. It includes both gcc 4.2 and 4.0, and can be used to build binaries that will run on both 10.5 and 10.6 systems.
Used for writing PNG files.
- Download the Source code .tar.gz from libpng.org and extract it.
- Build and install the library:
cd ~/Downloads/libpng-1.4.3 # or wherever it was extracted ./configure make sudo make install
The library files will be placed it in /usr/local/lib/, and png.h will be in /usr/local/include/, which are the default library and include search locations. You can use the --prefix flag for configure to pick a different location.
NOTE: you should probably restart the shell/Terminal instance so that the shell variables don't conflict with later commands.
If you would like to build the library with both 32- and 64-bit versions, and also allow running on 10.5 systems (even if you build on 10.6), the process is a bit more involved:
export MACOSX_DEPLOYMENT_TARGET=10.5 export CFLAGS="-Os -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk" export LDFLAGS="-arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk" ./configure --disable-dependency-tracking make sudo make install
Used for multi-threading, file system operations, and unit tests.
- Download from boost.org, pick .tar.gz or .tar.bz2 from the SourceForge download page, then extract it.
- Build and install the boost_thread library and all boost headers:
cd ~/Downloads/boost_1_44_0 # or wherever it was extracted ./bootstrap.sh --with-libraries=filesystem,system,test,thread ./bjam stage sudo ./bjam install
Again, the library files will be placed it in /usr/local/lib/, and all the necessary boost header files will be in /usr/local/include/. You can use the --prefix flag for bootstrap.sh to pick a different location. You can also omit the --with-libraries list to simply build and install all boost libraries.
If you want to build the library with both 32- and 64-bit versions, and support 10.5, the commands are more complicated. Note that the compiler is forced to be g++ 4.0 because 4.2 can't seem to link successfully (at least when targeting 10.5).
./bootstrap.sh --with-libraries=filesystem,system,test,thread echo "using darwin : 4.0 : g++-4.0 ;" >> tools/build/v2/user-config.jam ./bjam address-model=32_64 architecture=x86 macosx-version=10.5 toolset=darwin-4.0 stage sudo ./bjam address-model=32_64 architecture=x86 macosx-version=10.5 toolset=darwin-4.0 install
The build system used by c10t.
- Download the .dmg installer from cmake.org and install it.
- Pick Install Command Line Links at the end of the install. You may want to change the Install Folder from /usr/bin/ to /usr/local/bin/ (more commonly used for user-installed tools).
cd /path/to/c10t cmake . # the . is to build using the makefile from the current directory make
This will build the c10t binary with the default settings for the system you are on: 32-bit on 10.5 and 64-bit on 10.6.
If you want to explicitly build a 64-bit version:
If you want to build a "fat" binary with both 32 and 64-bit (requires all libraries to be "fat" as well):
If you want to target 10.5 systems on a 10.6 build:
export SDKROOT=/Developer/SDKs/MacOSX10.5.sdk export MACOSX_DEPLOYMENT_TARGET=10.5
If you get an error that unc.hpp is missing, you may need to do these 2 steps before the build:
git submodule init git submodule update