Compile In Mac OS X 10.6

From FreeOrionWiki
Jump to: navigation, search


This section is about compiling versions of the source code prior to revision 7120 in FreeOrion's SVN repository on Intel Macs with Xcode 3 and OS X 10.6. They might also work with Xcode 4 and OS X 10.7/10.8, but that's not guaranteed.



Intel Mac

CPU: Mimimum: Core2 Duo; Recommended: Core i5 or better

RAM: Minimum: 4GB; Recomended: 8GB or more (the more the better...)


Mac OS X 10.6.8

Xcode 3.2

Subversion - Subversion should be automatically installed when you install Xcode.

FreeOrion SDK version 2013-06-14 or earlier. Which version you need depends on which version of the source code you actually want to compile. To find out you'll need to dig through this forum thread, or go by trial and error. Old versions of the SDK can be downloaded here.

Build Directions

Preparatory work

Per default Xcode tends to allow too many compiler processes to run in parallel when building a project. When you try to build FreeOrion, this will likely cause Xcode to crash/freeze somewhere during the build process. Depending on your system's specifications it is highly recommended to lower this limit. You can go by trial and error, or you can just go with the following values which have been reported to work so far: 1 for system's with 4GB of RAM, 4 for systems with 8GB of RAM.

This limit can be set by executing the following statements in the terminal (N being the limit you want to set):

  • If you are using Xcode 3: defaults write PBXNumberOfParallelBuildSubtasks N
  • If you are using Xcode 4: defaults write IDEBuildOperationMaxNumberOfConcurrentCompileTasks N

Step by step

  • Open the SDK .dmg file you've downloaded
  • Copy the 'FreeOrionSDK' folder contained there to a directory of your choice
  • Run the bootstrap.command file inside the copied 'FreeOrionSDK' folder
  • Accept any certificates if SVN asks you to
  • This will pull the most recent version of the source code from the repository. To update your working copy to the desired revision, use the 'svn update' command.
  • When you're finally finished updating your working copy to the desired revision, close the terminal
  • Open the Xcode project located at 'FreeOrionSDK/FreeOrion/Xcode'
  • If you are using Xcode 4 or later: uncheck "allow debugging when using document revision mode" in the options tab of the run section of the scheme for for FreeOrion, if you don't do this, the resulting FreeOrion app bundle might crash when run (details can be found in this forum thread)
  • 'Active Configuration' must be set to either 'Test' or 'Release'. Note: 'Test' builds the binaries with additional safety checks ("assertions") enabled, resulting in program abortions when these safety checks fail. So, if you aim for serious testing and uncovering of issues, use 'Test', if you just want to happily play with a most up-to-date binary and not be bothered by program abortions because some minor internal safety checks fail, use 'Release'.
  • 'Active Target' must be set to 'FreeOrion'
  • 'Active Executable' must also be set to 'FreeOrion'
  • 'Active Architecture' must be set to 'i386' (it's the only choice anyway)
  • Press 'Command + B'
  • Depending on your system, this can take quite a while (40+ minutes for the initial build). Note that you computer might turn unresponsive while building. There also might occur segfault errors, just let the build process continue until it's finished, then press 'Command + B' again. Lather, rinse, repeat until the build process succeeds. However, this shouldn't take you more then three tries. If it doesn't build after he third try, your computer probably is not up to the task - sorry.
  • If the build succeeds you should see a new folder 'build' in the same directory the Xcode project is in. The newly built FreeOrion app bundle can be found in a folder with the name of the build configuration you've chosen ('Test' or 'Release') inside this 'build' folder.
  • If the build fails, check out the troubleshooting section of this article

In a nutshell

  • Download and unpack the SDK
  • Run the bootstrap.command script
  • Build the project in Xcode


Adding missing source files

When you get errors like

Undefined symbols for architecture i386:
  "_condition3_p", referenced from:
      (anonymous namespace)::Init()in libCommon.a(ConditionParser.o)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

it is likely that there is a file missing in the target you get the error from.

To add the file ('ConditionParser3.cpp' in this case), just drag it into the 'Compile Sources' section in the 'Build Phases' window of the target.

Other Compilation Errors

As obsolete versions of the SDK are no longer officially supported, you are more or less on your own finding out how to get around build errors. You can search the forum for old threads, maybe you get lucky and find something that addresses your problem. You can also post a report, as it can never hurt to ask, but be prepared that we most likely won't be able to help you. We just don't have the resources to support outdated versions of the SDK.