My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
DeveloperSetupGuide  
Instructions for how to set up a build environment for Omaha
Featured
Updated Aug 17, 2011 by ryanmyers@google.com

Introduction

These instructions are intended to assist the would-be Omaha developer with setting up an environment in which to successfully build the Omaha source code.

Required Downloads/Tools

The following packages are required to build Omaha:

  • A copy of the Omaha source code. This can be
    • You can either:
      • Download a full source package from the Downloads area.
      • See source checkout for setting up access to the subversion repository. This will also require SVN itself.
    • However you get the source code, it must be checked out or extracted to a directory named omaha exactly.
  • Microsoft Visual C++
    • You will need to have at least the Standard Edition of Visual C++ or Visual Studio, 2005 or later.
      • The Express Editions are not sufficient - they do not include ATL/MFC headers or libraries, which Omaha requires.
      • If you use Visual Studio 2008 or 2010, you will need an additional download. (In these versions, the ATL Regex library was removed from the standard ATL/MFC headers and moved into the open source ATL Server project.)
        • Download the ATL Server headers here.
  • Microsoft Vista SDK
    • Download the SDK here.
  • Microsoft .NET Framework 2.0
    • This should be pre-installed on Windows Vista and Windows 7.
    • To verify, see if the file %WINDIR%\Microsoft.NET\Framework\v2.0.50727\csc.exe exists on your system.
    • If not, you can download the installer here.
  • The Windows Template Library (WTL)
  • The Windows Install XML (WiX) Toolkit, version 3.0 or later.
    • Download any of the v3 binaries packages here.
  • Python 2.4.x (Be sure to use 2.4, newer versions currently break the build!)
    • Download Python here. It can coexist with newer Python installs on a system.
    • You'll also need the pywin32 (Python for Windows) extensions for Python 2.4. It can be downloaded here.
  • SCons 1.3.x (Be sure to use 1.3, the 2.0 series is not backwards-compatible!)
    • Download SCons here.
  • Google Software Construction Toolkit
    • Get the SCT source here, either via direct download or via SVN checkout.

Details

Installation

  1. Install each of the above software packages that comes with an installer, which is all of them except Omaha source code and the Software Construction Toolkit.
  2. Make sure you add the installed python directory to your path environment variable.
  3. Follow the Software Construction Toolkit installation instructions. Make sure you don't miss the part about setting up the SCONS_DIR environment variable.
  4. Extract or checkout the Omaha source code to a location of your choice, perhaps something like "C:\omaha".

Environment Variables

Create the following environment variables:

  • SCT_DIR - set to the directory of the Software Construction Toolkit (eg. C:\swtoolkit)
  • OMAHA_NET_DIR - This will depend on your OS:
    • On Windows Vista or if it was pre-installed on Windows XP, set it to the framework directory (something like C:\Windows\Microsoft.NET\Framework\v2.0.50727).
    • Otherwise, set it to the directory where the .NET framework is installed. (eg. C:\Program Files\Microsoft.NET\Framework\v2.0.50727)
  • OMAHA_WTL_DIR - set to the include directory in the WTL installation (eg. C:\Program Files\WTL\include)
  • OMAHA_WIX_DIR - set to the directory in WiX where 'candle.exe' and 'light.exe' are installed. This may be something like (eg. C:\Program Files\Windows Installer XML v3\bin)
  • OMAHA_VISTASDK_DIR - set to the directory where the Vista SDK was installed (e.g. C:\Program Files\Microsoft SDKs\Windows\v6.0)
  • OMAHA_PYTHON_DIR - set to the directory where python was installed. This directory should contain python.exe. (eg. C:\python_24)

Setup the environment variables for the installed version of Visual Studio

For the build script to pick up the correct version of Visual Studio, it is usually necessary to call a script provided with Visual Studio. For instance, in the case of Visual Studio 2005, the name of the script is vcvarsall.bat; for 2008 and later, the name is vcvars32.bat. If you are using 2008 or 2010, also make sure that the ATL Server headers have been downloaded and are added to the compiler include path.

It's highly recommended that you combine all of the above preparations in a batch file that can be reused. For example:

@echo off
rem -- Set all environment variables used by Hammer and Omaha. --
set OMAHA_NET_DIR=%WINDIR%\Microsoft.NET\Framework\v2.0.50727
set OMAHA_WTL_DIR=%ProgramFiles%\WTL\include
set OMAHA_WIX_DIR=%ProgramFiles%\Windows Installer XML v3.5\bin
set OMAHA_VISTASDK_DIR=%ProgramFiles%\Microsoft SDKs\Windows\v6.1
set OMAHA_PSEXEC_DIR=%ProgramFiles%\PSTools
set OMAHA_PYTHON_DIR=C:\Python244
set SCONS_DIR=%OMAHA_PYTHON_DIR%\Lib\site-packages\scons-1.3.1
set SCT_DIR=C:\swtoolkit
rem -- Add Visual Studio and Python to our path, and set VC env variables. --
call "%ProgramFiles%\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat"
path %OMAHA_PYTHON_DIR%;%PATH%
rem -- Add ATLServer headers to the Visual C++ include path. --
set INCLUDE=%INCLUDE%C:\atlserver\include;

Build

Once the above setup is complete:

  1. Open a fresh cmd.exe window (if you're running under Vista, make sure cmd.exe is running as Administrator)
  2. Navigate to the 'Omaha' directory, or whatever you called it.
  3. From the above directory, just type hammer to build Omaha! (Note: More advanced build options can be found in HammerOptions. In particular, if you are building on a multi-core or multi-processor, consider passing the -j# flag to Hammer to enable parallel compilation.)

Hammer should build Omaha, and then run a very limited set of unit tests, which must pass in order to complete the build.

A larger suite of unit tests is also included in the Omaha source.

Common Build Errors

  • When I attempt to run 'hammer', I get an error message saying that \hammer.bat can't be found.
    • This means that the build scripts can't find the Software Construction Toolkit (SCT).
      • Fix this by making sure that SCT_DIR and all the OMAHA_ environment variables listed above are set.
  • I get a build break in precompile.c, saying that it can't find atlrx.h.
    • This means that you're using a recent version of Visual Studio, made after Microsoft forked off ATL Server, and your copy of the MFC headers is missing this file.
      • Fix it by downloading and extract the ATL Server headers, and make sure that the path to them is in the INCLUDE environment variable.
  • I get the following error messages while building:
  •   "SignTool Error: The specified timestamp server could not be reached."
      "SignTool Warning: Signing succeeded, but an error occurred while attempting to timestamp: %FILE%"
    • This means that the Microsoft code signing tool is having trouble contacting timestamp.verisign.com for countersigning.
      • Fix it by ensuring that your build system has a functioning Internet connection and resuming the build.
  • The build appears to finish successfully, but when it runs the post-build unit tests, the OmahaCustomizationTest.IsInternalUser test fails and the build aborts.
    • This means that your build machine's DNS name and/or AD domain doesn't match the domain/company name set in main.scons.
      • This can be fixed in one of two ways:
        1. Move your build system onto your corporate network.
        2. Set the environment variable OMAHA_TEST_BUILD_SYSTEM=1 to disable this test.
  • The build appears to finish successfully, but when it runs the post-build unit tests, all of the ClientUtilsTest tests fail and the build aborts.
    • This means that you've changed the company or product name strings in main.scons, but haven't changed the localized string resources to match.
      • Fix this by updating the string resources in the following locations to have up-to-date company names:
        • goopdate\resources\goopdateres\*.rc
        • goopdate\resources\goopdate_dll\*.rc
        • mi_exe_stub\resources\*.rc

Running Unit Tests

The Omaha build proces includes building an automated unit test suite, based on the GTest framework. In order to run it, there are two pieces of preparation you must do:

  1. Create the following registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Google\UpdateDev. Then, add a string value named TestSource with the value ossdev.
  2. Download the Windows Sysinternals PSTools suite (available here) and save psexec.exe somewhere. Then, set an environment variable named OMAHA_PSEXEC_DIR to the directory containing psexec.exe.

When running unit tests:

  • You must be connected to the Internet for some tests to pass.
  • We recommend running them with administrator privileges, as some tests do not run otherwise.
  • Some tests do not run by default, because they take a long time or are otherwise inconvenient to run all the time. To run these tests, define the OMAHA_RUN_ALL_TESTS environment variable. For example, set OMAHA_RUN_ALL_TESTS=1.

To run the unit test suite, run the following executable after a successful build:

scons-out\dbg-win\staging\omaha_unittest.exe

Note that there are a few unit tests that are expected to fail on an unmodified build of Omaha. These are:

  • AppManagerReadAppPersistentDataMachineTest.ReadUninstalledAppPersistentData_UninstalledApp
  • AppManagerReadAppPersistentDataMachineTest.ClientStateExistsWithoutPvOrClientsKey
  • AppManagerReadAppPersistentDataUserTest.AppExists_NoDisplayName
  • AppManagerReadAppPersistentDataUserTest.AppExists_EmptyDisplayName
  • AppManagerReadAppPersistentDataUserTest.ReadUninstalledAppPersistentData_UninstalledApp
  • AppManagerReadAppPersistentDataUserTest.ReadUninstalledAppPersistentData_EulaNotAccepted
  • AppManagerReadAppPersistentDataUserTest.ClientStateExistsWithoutPvOrClientsKey
  • AppManagerReadAppPersistentDataUserTest.ClientStateExistsWithEmptyPvNoClientsKey
    • These depend on localization changes. They will disappear once you update the string resources to match your company name.
  • InstallManagerInstallAppMachineTest.InstallApp_MsiInstallerSucceeds
  • InstallManagerInstallAppMachineTest.InstallApp_MsiInstallerWithArgumentSucceeds
  • InstallerWrapperMachineTest.InstallApp_MsiInstallerSucceeds
  • InstallerWrapperMachineTest.InstallApp_MsiInstallerWithArgumentSucceeds
    • These tests use a small MSI installer in testing\unittest_support that is hardwired to write some data to the the Google Update registry paths. The WiX sources for this MSI are in test\test_foo.wxs.xml -- update this to contain your company and product name, build the new MSI, and drop it into unittest_support.

Common Unit Test Issues

  • The following tests are failing:
  •    SetupUserTest.TerminateCoreProcesses_BothTypesRunningAndSimilarArgsProcess
       SetupMachineTest.TerminateCoreProcesses_BothTypesRunningAndSimilarArgsProcess
    • This means that psxec.exe can't be found.
      • Fix it by making sure that the environment variable OMAHA_PSEXEC_DIR contains a valid path to your install of PSTools.
  • The HighresTimer.SecondClock test is failing.
    • This test is not reliable on virtual machines.
      • Fix it by allocating higher priorities to the virtual CPU performing the build, or running the unit tests on a physical CPU.

Testing Omaha Against Google Servers

By default, the public version of Omaha continues to point to google.com for downloads and update checks. You can test the operation of an unmodified client by attempting to download and install a Google product, using your build of Omaha against the official Google Update servers. For example:

  • Google Chrome (run as admin):
  • scons-out\dbg-win\staging\GoogleUpdate.exe /install "bundlename=Google%20Chrome%20Bundle&appguid={8A69D345-D564-463C-AFF1-A69D9E530F96}&appname=Google%20Chrome&needsadmin=True&lang=en"
  • Google Talk Bundle (run as normal user):
  • scons-out\dbg-win\staging\GoogleUpdate.exe /install "bundlename=Google%20Talk%20Bundle&appguid={D0AB2EBC-931B-4013-9FEB-C9C4C2225C8C}&appname=Google%20Talk%20Plugin&needsadmin=False&lang=en"

The client should contact google.com for a version query, then download and install the product. (However, you can expect it to fail shortly after install with the error code 0x80040905. This is due to these products writing their registration information to the Google Update area of the registry, instead of your Omaha's location.)

You can check UsingOmaha for more detailed examples.

Converting Omaha to Google Update

The version of Omaha on Subversion has a few changes from the official Google Update release to prevent forks from overwriting official data. These are:

  • Different COM CLSIDs, IIDs, and ProgIDs
  • Different company/product name strings (used to generate Registry locations)
  • Different prefixes for shared Win32 object names

If you would like to convert Omaha to Google Update, you can do this by copying the contents of the official\ subdirectory on top of the Omaha source code.

Comment by setiawan...@gmail.com, Apr 10, 2009

saya mau mendapatkan restribusi penuh dari google tapi saya orang bodo yg ingin maju,sukses

Comment by dawitakl...@gmail.com, Apr 13, 2009

WOW am i the first one here who thinks this is cool? Thanks google.....now can we get source code for Google search engine it self...thanks!

Comment by albertof...@gmail.com, Apr 13, 2009

Agree with dawita :D

Comment by mailwang...@gmail.com, Apr 13, 2009

This is cool, thanks.

Comment by rwparris2, Apr 13, 2009

Thanks for opening up the source!

Any chance this will ever be cross platform?

Comment by djn...@gmail.com, Apr 14, 2009

Running Omaha Unit Tests by manually setting Registry Key:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Google\UpdateDev]
"TestSource"="dev"
Comment by adi.ya...@gmail.com, Apr 14, 2009

sounds good people....:) @rwparris2 ..dude this why do we need it cross platform... update-engine is thr for mac/osx and linux has a zillion more options...apt/yum/pacman..why waste effort in replacing them when they are already mature enough..

Comment by pgath...@gmail.com, Apr 15, 2009

I wonder why you have to install lots of supporting applications just to compile this updater, why not work from one environment e.g. visual c++ or Python, better still Delphi...but both, to me this an overkill.

Somebody explain to me why we need all this pieces!

Comment by sor...@gmail.com, Apr 15, 2009

There are quite a few of prerequisites indeed.

A few are needed to support the build system. We've found Visual Studio-style solutions do not scale well and integrate with automated build farms. That's why we have dependencies on Python, Scons, and SCT are for. Wix is needed to generate the MSI/MSP artifacts. The rest of the depencencies are the development tools for Windows.

Comment by weinja...@gmail.com, Apr 15, 2009

If you have both VS2005 and VS2008 installed, you should run "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat" to set your environment variables for VS2005. This can save you some headaches.

Comment by pgath...@gmail.com, Apr 15, 2009

sorinj, For christ sake why python 2.4? why not 2.5! which is widely used! And can it compile on XP? Is it possible to get some sort of a SR documentation for the updater, i would want to read how the updater works. Thanks

Comment by Cadenza...@gmail.com, May 4, 2009

mi.res : fatal error LNK1103: debugging information corrupt; recompile module scons: building terminated because of errors.

;-(

VISTA + VS2005 + WINSDKV6.1

Comment by sor...@gmail.com, May 5, 2009

Would it help deleting the whole scons-out and starting over?

Comment by djn...@gmail.com, May 14, 2009

I have a question Omaha use WIX for create installers, I can use any? for example Inno Setup?

Thanks for the answer :)

Comment by ddor...@google.com, May 14, 2009

Omaha supports .msi and .exe installers. Applications can create their installers however they want as long as they are valid MSI or EXE installers and run silently.

As part of the build, Omaha uses WiX to generate MSIs for use in testing.

Comment by michael....@gmail.com, Jul 2, 2009

Hammer pukes on me after I go through the setup:

  E:\Development\Projects\Omaha>hammer
  scons: Reading SConscript files ...
  Using precompiled headers.
  Working on versions: 1.2.177.0 
  AttributeError: SConsEnvironment instance has no attribute 'WiX':
    File "E:\Development\Projects\Omaha\main.scons", line 736:
    windows_coverage_env

Envt:

OMAHA_NET_DIR=C:\Windows\Microsoft.NET\Framework\v2.0.50727
OMAHA_PYTHON_DIR=C:\Python25
OMAHA_VISTASDK_DIR="C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A"
OMAHA_WIX_DIR=E:\Development\Tools\Windows Installer XML v3
OMAHA_WTL_DIR=E:\Development\Tools\WTL80
SCONS_DIR=C:\Python25\Lib\site-packages\scons-1.2.0
SCT_DIR=E:\Development\Tools\swtoolkit
WIX=E:\Development\Tools\Windows Installer XML v3\

Vista 64, Win SDK 6.0A, Visual Studio 2008

:( thoughts?

Comment by ddor...@google.com, Jul 2, 2009

The WiX tool is added at line 566 of main.scons, so 'WiX' should be found. It looks like you are using Python 2.5. As noted above, Python 2.4 is required as other versions have been seen to break the build. There appear to be incompatibilities with SCons and other versions of Python. It's possible that this is what is causing this problem.

Another possibility is that something is not correctly handling the spaces in your OMAHA_WIX_DIR value. Maybe try using a path without spaces. The environment variable WIX should not be necessary.

Comment by 2828...@gmail.com, Jul 12, 2009

where is the server source code?

Comment by ddor...@google.com, Jul 13, 2009

The server is not open source. I've added some information about the protocol to the wiki: http://code.google.com/p/omaha/wiki/ServerProtocol.

Comment by amckern, Dec 20, 2009

The link to WiX is broken - consider this one instead http://sourceforge.net/projects/wix/files/

Comment by sth1...@gmail.com, Jul 7, 2010

is not support delphi?i want use it in http://www.free-registry-cleaners.org/

Comment by wudongy...@gmail.com, Jul 16, 2010

How to run the unit tests?

Comment by wudongy...@gmail.com, Jul 16, 2010

well, it's \omaha\scons-out\dbg-win\staging\omaha_unittest.exe

Comment by a.ratn...@gmail.com, Sep 9, 2010

Can I know what are the pre-requisites for Omaha client and Server to start with??

Comment by a.ratn...@gmail.com, Sep 13, 2010

Will it support Windows 2008 R2?? What would be the SDK version??

Comment by lucian.t...@gmail.com, Mar 23, 2011

I have just downloaded the omaha sources and there is no .sln or .vcproj files. Am I missing something? Do I have to generate them by running a script or do I have to make my own solution?

Comment by russell....@gmail.com, Apr 11, 2011

Getting an immediate error after running hammer (trace back below); cant find scons.script. I've read many postings from people having a similar issue with scons in other contexts but no responses that bring a resolution. OS = Win7.

Traceback (most recent call last):

File "C:\Program Files\Software Tool Kit\wrapper.py", line 44, in ?
import SCons.Script
ImportError?: No module named SCons.Script

Comment by russell....@gmail.com, Apr 12, 2011

(last problem resolved) Had to add C:\Python24\scons-1.3.1 to PYTHONPATH environment variable. Now running into missing atlrx.h which is no longer shipped with VS2008 (or later). Using the one from VS2003 results in another compilation error.... is VS2008 really supported?

Comment by russell....@gmail.com, Apr 12, 2011

Had to pull atlrx.h (no longer part of VS) from the ATL Server project on CodePlex?, copied this to ATLMFC\include folder under VS2008 and was able to build sucessfully.

http://atlserver.codeplex.com/

Comment by grey220022@gmail.com, Apr 12, 2011

Cool

Comment by vgachka...@gmail.com, May 24, 2011

Will I be able to build Omaha with VS 2010 Express and MFC/ATL headers/libraries installed from DDK?

Comment by phelpsja...@gmail.com, May 27, 2011

cool

Comment by restanti...@gmail.com, Sep 12, 2011

I am trying to build the vcproj files for the whole solution using scons parameters. This is my starting point : http://www.mereidea.com/blog/2009/04/30/creating-visual-studio-projects-in-scons/

If anyone has already done this, please give me an email at restantitron@gmail.com

Comment by gavin.st...@gmail.com, Sep 22, 2011

There are quite a few inconsistencies/missing steps in this document:

1. "If you use Visual Studio 2008 or 2010, you will need an additional download. (In these versions, the ATL Regex library was removed from the standard ATL/MFC headers and moved into the open source ATL Server project.)" Nothing tells you what to do with these once you get them... Answer: extract the contents of the ATL_Server_Source?_and_Headers_9_0_70425_Alpha\include folder to C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include

2. In Required Downloads section: "However you get the source code, it must be checked out or extracted to a directory named omaha exactly." The in details section "Extract or checkout the Omaha source code to a location of your choice, perhaps something like "C:\omaha". again in build section: "Navigate to the 'Omaha' directory, or whatever you called it." So, does it need to be exactly "omaha" or not?

3. "SCons 1.3.x (Be sure to use 1.3, the 2.0 series is not backwards-compatible!)" Might want to mention that IT WON'T WORK, you will get, "File "C:\Program Files\Software Tool Kit\wrapper.py", line 44, in ? import SCons.Script ImportError??: No module named SCons.Script"

unless you install the windows .exe version: scons-1.3.1.win32.exe. Extracting the zip and putting it in C:\Python24\Lib\site-packages\scons-1.3.1 is not enough..

4. It talks about setting all kinds of Environment variables and then contradicts itself and tells you to put them all in a batch file. If the batch file was recommended, maybe it should be mentioned first. if you are following these instructions from top to bottom, you will have already created ENV variables before you hit the part "It's highly recommended that you combine all of the above preparations in a batch file that can be reused."

And finally, it appears VS2010 is not supported.. even being installed.. see http://groups.google.com/group/omaha-discuss/browse_thread/thread/342cb3a79d9e60fd

After changing my environment variables/setup batch file to point to 9.0 instead of 10.0, it starts compiling with 9.0 but switches to 10.0 and fails. I was only able to get this to compile on another machine with only VS 2008 installed.

I finally got this to build but not before 2 frustrating nights pulling my hair out... now the unit tests fail.. I hope using this is easier than getting it to compile ;)


Sign in to add a comment
Powered by Google Project Hosting