Difference between revisions of "BuildTheCode"

From Sirikata Wiki
Jump to: navigation, search
m (Mac XCode Project)
m (Mac XCode Project)
Line 182: Line 182:
         3. select active build configuration Debug
         3. select active build configuration Debug
   14. close XCode to save the project
   14. close XCode to save the project
   15. reopen the XCode project
   15. reopen Sirikata.xcodeproj
   16. build it
   16. build it
   17. Debugger
   17. Debugger

Revision as of 16:17, 18 August 2009


Sirikata depends on quite a bit of external code to make everything work. We'll try to maintain a full list of dependencies and brief descriptions of how they're used here.

When building Sirikata you have two options: handle installing dependencies yourself or use our install script to help you build and install everything that's needed. The instructions here will explain how to use our install script. Generally, as long as you use the correct version, standard install procedure applies to all packages. For any where we require a custom build or non-standard build parameters, we'll note that on the dependencies page.

You can look at the install script for more details, but the basic outline of what the install procedure does for all platforms is:

  • Figure out which platform you're on, possibly which version and development tools as well.
  • Checkout the platform specific directory from our dependencies repository. This includes a second stage install script and source and binary packages.
  • Run an install script from this repository which:
    • Possibly tries to install system provided packages that we need
    • Extracts binary packages locally in your tree
    • Compiles source packages and installs them locally in your tree

Note that some of the dependency files are quite large. When you run the install commands, it may appear the script has hung, but its likely just checking out the packages.


Using Cygwin (easy)

Windows never requires root access or build tools; all dependencies are binaries that are installed into your source tree (under sirikata/dependencies). To install simply run these commands in a Cygwin bash shell:

 cd sirikata/
 make depends

You should now have a sirikata/dependencies directory containing all the dependencies.

Alternatively, if you only want required dependencies (e.g. to avoid building plugins you will not be using), you can install a minimal set of dependencies.

 cd sirikata/
 make minimaldepends

CMake is not included in this installation. You should use the install tool from the CMake website.

Without Cygwin (manual)

While Cygwin is a useful tool, the requirement of a Cygwin installation for the windows compile is not necessary.

You will need to install a SVN client (e.g. TortoiseSVN). Then, checkout:

and name that directory "dependencies".

If using a command-line SVN client, run "svn co http://sirikata.googlecode.com/.../win32vc9 dependencies"

Then, go into the dependencies folder and unzip all of the packages directly into the dependencies directory. Make sure to select "Extract Here"--if that option is not available, in the extraction dialog, remove the name of the zip file from the end, so it just ends with "dependencies". The extracted directories should not have the same name as the zip files.


Most dependencies are binaries that are installed into your source tree (under sirikata/dependencies). To install simply run the commands:

 cd sirikata/
 make depends

You should now have a sirikata/dependencies directory containing most of the dependencies.

To get the last dependency please download Mono 2.4 or later from the mono website http://www.mono-project.com/ And invoke the installer .pkg. This installer will place a Mono.frameworks folder in /Library/Frameworks

Alternatively, if you only want required dependencies (e.g. to avoid building plugins you will not be using like mono), you can install a minimal set of dependencies.

 cd sirikata/
 make minimaldepends

Again, the Mac may not come with the correct version of cmake. You can go to the CMake website for the latest package, or else you can install it using MacPorts.


Currently the install script expects an Ubuntu system, 8.04 or greater. There are three modes of installation - basic, full, and minimal. The basic mode will install everything it can within the source tree and won't try to install any system libraries (i.e. it assumes you have already installed libraries for which the system provided versions are sufficient). This is useful if you just need to get the custom dependencies in a new clone, having already built Sirikata before.

The dependencies are actually stored on an svn server, so first make sure you have svn installed:

 sudo apt-get install subversion

To install using the basic mode issue these commands:

 cd sirikata/
 make depends

The full mode requires root access and will install system libraries as well. This mode is a superset of the basic mode. To install in this mode, issue the following commands:

 cd sirikata/
 make fulldepends

The minimal mode installs as little as possibly needed to get up and running. Note that you will get fewer plugins if you use this set. Note again that this doesn't install any of the system dependencies.

 cd sirikata/
 make minimaldepends

Make sure you have the latest submodules

 git submodule init
 git submodule update

Building Sirikata

We use CMake to generate our build scripts. Make is used on Mac and Linux and Visual Studio is used on Windows to perform the actual build. All three builds follow the same basic steps:

  • Run cmake, possibly modifying the configuration.
  • Run your build tool.


Start up CMake and point both paths to sirikata/build/cmake. Hit configure twice. If you installed any dependencies in non-standard locations, point CMake to them now. To generate the build files, hit OK.

Now browse to sirikata/build/cmake. Open Sirikata.sln and run Build All.

This should result in all libraries, plugins, and binaries in the sirikata/build/cmake/debug or sirikata/build/cmake release, depending on which configuration you built.


  • There aren't standard locations to search for dependencies on Windows. Obviously we've setup the build system to work cleanly with the dependency install script. The easiest way to get a manual installation of dependencies on Windows to work is to use the same layout as the install script, where all dependencies are located in sirikata/dependencies. If you don't do this, you will almost certainly need to manually specify the locations of some libraries in CMake.
  • The build is known to work for VS2005 and VS2008. However, be aware that for VS2005 you must have the latest service pack installed.
  • If you get error 0xc0000022, check the permissions of the sirikata top-level directory. If you used Cygwin's version of git, it will remove execute permissions for security purposes. You may enable execute by doing "chmod -R +x sirikata" in cygwin, or Granting yourself Full Control in Right Click->Properties->Security (make sure to click the Replace All Entries in Child Objects checkbox).

DLL Path under windows

[If you get a message saying anything like 0xc0150002, "failed to initialize properly", "the runtime asked to terminate", or about "reinstalling the application": If you use Visual Studio 2005, you must have Service Pack 1 installed. Also, you may need to install the "Visual C++ Redistributable Package".]

In order to get Sirikata to find the required DLLs, you must copy all DLL files from these directories into the "build/cmake" directory:

  • dependencies\boost_1_37_0\lib
  • dependencies\installed-curl
  • dependencies\ogre-1.6.1\bin
  • dependencies\SDL-1.3.0\bin
  • dependencies\protobufs\bin

Note that Sirikata currently does not work in Windows 2000, due to the lack of a few raw input functions (RegisterRawInputDevice) that SDL 1.3 uses. This will hopefully be fixed in SDL at some point to make it use the old DirectX raw input system.

Mac and Linux

For convenience we provide a top level makefile which performs the standard build operations. If you want a default build and have used the install script for dependencies, do:

 cd sirikata/

If you'd like to run the build manually, do the following (essentially what is in the makefile):

 cd sirikata/build/cmake
 cmake . [-DCMAKE_BUILD_TYPE=Debug|Release]

To interactively adjust settings, for instance to point CMake to a different version of libraries:

 cd sirikata/build/cmake
 ccmake .

When the build completes you should have the libraries, plugins, and binaries in sirikata/build/cmake.

Mac Notes

For the mac, you must make a symbolic link one level above cmake, to the Frameworks directory in dependencies. This is required to emulate the structure of a Mac Application which has Frameworks one level above the MacOS binary directory.

 cd sirikata/build
 ln -s ../dependencies/Frameworks

Mac XCode Project

Many mac developers prefer to use the XCode programming environment. To do this, cmake will need to be configured to use XCode

Steps are:

  1. test -d build/cmake/Debug || mkdir build/cmake/Debug
        1. The directory for XCode build products
  2. python csv_converter.py build/cmake/Debug/scene.csv scene.db
        1. Generate a scene for use by the XCode project
  3. cd build/cmake
  4. ln -s ../../dependencies/Frameworks Frameworks
        1. to fix brittle paths in Xcode project.
  5. cmake -G Xcode .
  6. cd Debug
  7. ln -s ../Sirikata.Protocol.dll Sirikata.Protocol.dll
  8. ln -s ../Sirikata.Runtime.dll Sirikata.Runtime.dll
  9. cd ..
  10. launch Xcode
  11. open Sirikata.xcodeproj
  12. edit project settings
        1. general tab
        2. choose project root
        3. select build/cmake directory. click ok. value should just be <Project File Directory>.
              1. This fixes problem that prevents debugger from working.
  13. project menu
        1. select active target ALL_BUILD
        2. select active project executable cppoh
        3. select active build configuration Debug
  14. close XCode to save the project
  15. reopen Sirikata.xcodeproj
  16. build it
  17. Debugger
        1. Confirm that you can set a break point.
        2. Run debugger
        3. Confirm that it stops at a break point.
        4. Confirm that it displays source code.
        5. (trouble shoot back to step 10)

Running Sirikata

The master branch has evolved into a number of programs that communicate with each other.

To start a server run the binaries




Once these are loaded, the client may be connected. Clients need databases. A default database may be generated by running

python csv_converter.py scene.csv build/cmake/scene.db


python csv_converter.py scene.csv build/cmake/scenebig.db

The name of the executable you need to run is called "cppoh_d". By default it will load up a demo scene from scene.db, which requires to download about 450 MB of assets because of the large textures sizes.

To specify other scenes run

cppoh_d --db=/path/to/scene.db