My favorites | English | Sign in

V8 JavaScript Engine

How to Download and Build V8

This document describes how to download and build V8 on a Linux (Intel or ARM-based), Windows XP or Vista, or Mac OS X 10.5 (Leopard) platform.

Contents

Back to top

Pre-requisites

You will need one of the following platforms:

  • Linux (Intel or ARM-based).
  • Windows XP SP2 or later, or Windows Vista.
  • Mac OS X 10.5 (Leopard).

Pre-requisites for all platforms are:

Platform-specific pre-requisites are:

Note: If you are developing on a Mac and have Apple's Xcode installed you will already have Subversion version 1.4.4, Python 2.5, and the Gnu Compiler (GCC) 4.x.x. This means you only need to install SCons.

To check correct installation and version, start a shell on Linux or Mac and a command prompt on Windows, then execute the following commands to print the version number of each of the tools.

  $ svn --version 
  $ python -V 
  $ scons --version 

Back to top

Download the Source Code

V8 is hosted on Google Code project hosting, so you check out the source for V8 using a Subversion client as you would for any other project hosted on Google Code. Anyone can obtain a read-only copy of the V8 source. To contribute to the project you will need a Google account.

See the project source code access page for instructions on accessing the V8 source code.

Back to top

Build

The build process is the same for all platforms. However, to build on Windows some additional configuration is required, see the Wiki on http://code.google.com/p/v8/ for details.

The simplest way to build V8 is to enter the directory into which you have checked out the V8 source and type scons, with no arguments. The build script will attempt to guess which platform you're building for and will then build the optimized version of V8 as a library in the current directory.

Alternatively, the build can be configured by using options when you run scons. You can get a list of the options and their possible values by running scons --help. Build options follow, defaults are in italics and first in the list:

  • mode=[release|debug]
    Specifies whether to build the release version or debug version. The default is to build the release version. If you want to:
    • build the debug version, use mode=debug. This build includes debugging information and assertions. Output is in the current directory and temporary build files are in the obj/debug directory.
    • build the release version, use mode=release. This build does not include debugging information or assertions. Output is in the current directory and temporary build files are in the obj/release directory.
  • snapshot=[on|off]
    Specifies whether or not to use snapshots which cause startup to be faster. Using snapshotting increases the executable file size by approximately 160 Kbytes.
  • library=[static|shared]
    Specifies whether to build a static or shared library.

For example, to get a shared debug library that uses snapshots type the following at the command line from the directory in which you checked out the V8 code:

 scons mode=debug library=shared snapshot=on

To build the V8 shell sample in release mode:

 scons sample=shell

To build the V8 developer shell in release mode:

 scons d8

Back to top