Skip to content

Building ChakraCore

Andrey Taritsyn edited this page Apr 27, 2017 · 30 revisions

Windows

You can build ChakraCore on Windows 7 SP1 or above, and Windows Server 2008 R2 or above, with either Visual Studio 2013 or 2015, as long as C++ support is installed*.

Refer to the Linux and OS X sections for building instructions on these platforms.

To build ChakraCore on Windows:

  • Clone ChakraCore through git clone https://github.com/Microsoft/ChakraCore.git
  • Open Build\Chakra.Core.sln in Visual Studio.
  • Select the target Platform and Configuration and build the solution.
  • Build output will be under Build\VcBuild\bin.

Alternatively, run msbuild on the command line:

msbuild /m /p:Platform=... /p:Configuration=... Build\Chakra.Core.sln

Platforms

ChakraCore on Windows can be built for 3 Platforms: x86, x64 and arm.

Building for arm: Due to toolset dependency, you will need following to build for the arm platform:

Configuration

ChakraCore on Windows supports 3 configurations:

  • Debug: Not optimized, with full runtime checks and all test hooks.
  • Release: Fully optimized, with fewer runtime checks and no test hooks.
  • Test: Optimized, very similar to Release but with more runtime checks and most test hooks.

Deployment

If you use ChakraCore you will need to deploy ChakraCore.dll with your application. You may also need to redistribute MSVC runtime libraries because ChakraCore.dll has runtime dependency on MSVC libraries by default. For more information see Redistributing Visual C++ Files.

Alternatively, you can build ChakraCore without MSVC runtime dependency. Pass an additional parameter to msbuild so that ChakraCore links to MSVC libraries statically:

msbuild ... /p:RuntimeLib=static_library ...

Linux

Steps below are tested on Ubuntu 16.04LTS and Fedora 24. In order to compile ChakraCore on other Linux distrubitions, use distro's package manager instead of apt-get / dnf to install given dependencies below.

To build ChakraCore on Linux: (requires Clang 3.7+ and Python 2)

Installing build dependencies

Dependencies - Centos / Fedora (or similar)
su
dnf group install -y "Development Tools" "C Development Tools and Libraries"
dnf install -y git cmake clang gcc gcc-c++ kernel-devel python llvm
dnf install -y libuuid-devel lttng-ust-devel.x86_64 libicu-devel.x86_64
dnf install -y libstdc++-static.x86_64
Dependencies - Debian/Ubuntu (or similar)
su
apt-get update
apt-get dist-upgrade
apt-get install -y git build-essential cmake clang libicu-dev libunwind8-dev

Clone and Build

  • Clone ChakraCore.
    • mkdir Github && cd Github
    • git clone https://github.com/Microsoft/ChakraCore
  • Let's build!
    • cd ChakraCore
    • ./build.sh
    • You can specify --debug or --test-build to build.sh to select Debug or Test build flavors respectively. Default is Release build.
    • You can specify --static to build ChakraCore as a static library.
  • If you'd like to build using ninja instead of cmake:
    • sudo apt-get install -y ninja-build (for Debian/Ubuntu) dnf install -y .... (for Centos/Fedora)
    • Run ninja --version and ensure that at least version 1.3 is installed.
    • Specify the -n flag to build.sh to build with ninja.
    • [Optional] Install some useful packages for better development experience.
    • Download and install VSCode.

OS X

You may need to setup Homebrew to install additional dependencies.

To build ChakraCore on OS X: (requires OSX 10.8+, XCode 7.0, and Python 2)

  • Install dependencies.
    • xcode-select --install
    • brew install cmake icu4c
  • Clone ChakraCore.
    • mkdir Github && cd Github
    • git clone https://github.com/Microsoft/ChakraCore
  • Let's build!
    • cd ChakraCore
    • ./build.sh --static --icu=/usr/local/opt/icu4c/include --test-build -j=2

Some details on build script arguments used above:

  • --static embed JSRT as a static library
  • --icu=.. specify the location of ICU library (use --no-icu if you don't need unicode support)
  • --test-build enable command line options and some optimizations
  • -j=2 compile with 2 threads
Clone this wiki locally