BuildTheCode

From Sirikata Wiki
Revision as of 05:15, 27 May 2009 by PatrickHorn (talk | contribs) (→‎Notes: added note about windows execute permissions)
Jump to navigation Jump to search

Dependencies

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.

Windows

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.

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 ("Extract here"). The extracted directories should have generic names like "installed-curl".

Mac

The mac will not require root access; all 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 all the dependencies.

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.

Linux

Currently the install script expects an Ubuntu system, 8.04 or greater. There are two modes of installation - basic or full. 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. 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

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.

Windows

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.

Notes

  • 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".]

Currently, we dynamically link to Boost, cURL, OGRE, SDL and some other libraries as well. However, there is currently no install script to move them to the correct place. In order to have windows find these DLLs, you have a couple of options. Choose the one that feels the most natural to you.

Put the DLL folders in your path.

  • Add all of the folders containing dll's into your PATH environment variable, for example, if you installed to C:\sirikata, use:
    • C:\sirikata\dependencies\boost_1_37_0\lib;C:\sirikata\dependencies\installed-curl;C:\sirikata\dependencies\ogre-1.6.1\bin;C:\sirikata\dependencies\SDL-1.3.0\bin
  • To set the PATH environment variable:
    • right click on My Computer, select Properties, click on the Advanced tab, and click on Environment Variables....
    • Then, you can choose if you want to set the Current User or the Local Machine environment variables, and click on appropriate the PATH variable, and click Edit....
    • Set the cursor at the end of the text field, and add a ";", followed by each individual path.

Or, move the DLLs into the same directory as the executable:

  • Copy the .dll's out of the dependencies\boost_1_35_0 folder and into the build\cmake\Debug folder.

Or, move the DLLs into a common folder (or system directory):

  • A hybrid of the above two, is to move all of the DLLs into a common folder, maybe called "dlls".
  • Then edit environment variables as described above, and add just the "dlls" folder to the PATH.

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/
 make

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]
 make

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.