# Project Omaha

Name:
Project Omaha
Tags:
Description:
Information relating to Project Omaha, the open source software updater by Google.
Last Update:
2011-06-01

## Compilation with Visual Studio 2008 under Windows XP

Project Omaha can be quite tedious to compile under Windows XP due to some of its aspects being outdated. Below are the steps I used to get Omaha successfully building on June 1st, 2011.

The first step is to download all of the dependencies Omaha requires to build.

The following packages should be downloaded and installed in the following order (as they have Windows installers):

I have included in brackets the versions that I used when getting this to build properly.
• Microsoft Visual Studio 2008 [9.0]
• Windows SDK [6.0A] (should be installed with VS2008)
• .NET Framework 2 [2.0.50727] (should be installed already)
• Python 2.4 [2.4.4]
• SCons [1.3.1]
You MUST use SCons from the pre-2.0 branch at the time of this writing, as Omaha depends on the _scons_optparse library which was removed in 2.0.

The following dependencies do not have installers and must be downloaded to a folder of your choice, which will be referenced later. In my case I will use C:\utils.

• WTL [81_9127] (zip extracted to C:\utils\WTL-81_9127)
• swtoolkit [must be checked out from svn] (checked out to C:\utils\swtoolkit)

### Setup dependencies

The next step is to set up all of your various dependencies to make sure that Omaha can find them. In order to do this you will need to Add and Edit some various environment variables. This can be done by right-clicking on My Computer, selecting Properties, going to the Advanced tab, and clicking Environment Variables.

#### Python

First we need to add python to the global Path, so find the Path environment variable, and append the path to your installed python 2.4 instance to it (in my case, I added “;C:\Python24”).

#### SCons

Next we need to tell the system where to find SCons. This is done by adding a variable called SCONS_DIR, and adding the path to SCons. This should be under “[your python24 dir]\Lib\site-packages”. (in my case, I set SCONS_DIR to “C:\Python24\Lib\site-packages\scons-1.3.1”).

The next step is to download and extract the Omaha source code. You can find it here. At the time of this writing, I used version r104.

Once you've downloaded the source release, extract it anywhere, but YOU MUST NAME THE FOLDER YOU EXTRACT IT TO “omaha” (in my case, I extracted to “C:\omaha”).

I'm not kidding. The folder you extract the source to has to be explicitly named “omaha” or else the build will fail.

Once that's done, go back into the Environment Variables setup, and set the following variables:

• SCT_DIR - the path to swtoolkit (in my case “C:\swtoolkit”)
• OMAHA_NET_DIR - the path to the .NET framework (in my case “C:\Windows\Microsoft.NET\Framework\v2.0.50727”)
• OMAHA_PYTHON_DIR - the path to python 2.4 (in my case “C:\Python24”)
• OMAHA_VISTASDK_DIR - the path to the Windows SDK (in my case “C:\Program Files\Microsoft SDKs\Windows\v6.0A”)
• OMAHA_WIX_DIR - the path to the WiX bin directory (in my case “C:\Program Files\Windows Installer XML v3.5\bin”)
• OMAHA_WTL_DIR - the path to the WTL include directory (in my case “C:\WTL81_9127\Include”)

Lastly, create a file in your base Omaha directory called envsetup.bat, and point it to the VS2008 VCVarsAll batch file. This will be used to set up our environment before building. It should contain the following:

envsetup.bat
@call "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"

### Perparing for failures

There are some problems with building Omaha with Visual Studio 2008. These caveats need to be taken care of before we build.

#### Copy over the proper ATLMFC headers

Omaha uses ATLMFC, which was being phased out after Visual Studio 2005, so Visual Studio 2008 is missing a few of the required header files in order to build it, specifically atlrx.h.

To get around this, first download the ATL Server zip (at the time of this writing, version 9.0.70425_Alpha), and copy the include/atlrx.h file from inside the zip to the ATLMFC/Include directory of Visual Studio 2008 (in my case “C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include”).

This should solve problems with missing headers.

#### Incompatibility with Visual Studio 2010

If you have Visual Studio 2010 installed on the same machine you intend to build on, it will cause a huge slough of errors. This is because for some reason, Omaha tries to use Visual Studio 2010's version of ATLMFC, even though our envsetup.bat file specifies to use the Visual Studio 2008 ones.

I am not sure why this happens, but the easiest solution is to rename the Visual Studio 2010 folder before building, and rename it back afterwards. This will break the VS2010 paths and cause Omaha to fall-back to the VS2008 paths.

In my case, I ended up renaming “C:\Program Files\Microsoft Visual Studio 10.0” to “C:\Program Files\Microsoft Visual Studio 10.0hideme” and back again.

### Building Omaha

Time for it to get fun. Now you need to open a new command window. To do this go to StartRun… and type “cmd”.

Do NOT use a stale command prompt at this point. You need to make sure that your command prompt has all of the recently updated environment variables.

Now first change directories to your omaha directory.

cd C:\omaha

Then run your environment setup to update environment variables to point to VS2008

This only needs to be done once per command prompt.
envsetup

Lastly, start the build (it's HAMMER time!)

hammer

If all goes well, you should get a working build output to the scons-out directory.