Skip to content

Building and installing HHVM on Ubuntu 12.04

sgolemon edited this page Jul 30, 2012 · 36 revisions

(This page is a work in progress. Instructions are for building the HipHop VM, or HHVM for Ubuntu 12.04 64bit. HHVM is currently found only in the VM branch)

Easy installation

There is an easy installation script that will install all dependencies, patch files where appropriate, and install hiphop-php (hphp) as well as the hiphop-vm (hhvm). The easy installation does not include the optional JEMalloc 3.0 support however. This script is included as a part of the easy-ubuntu project. To install using easy-ubuntu, do the following:

Using sudo or as root user:

sudo apt-get install git-core
git clone git://github.com/ambelovsky/easy-ubuntu.git
cd easy-ubuntu/hiphop-php
sudo chmod 777 ./install.sh
sudo ./install.sh

Standard Installation

By building manually, you can optionally include JEMalloc 3.0 support.

Packages installation

Using sudo or as root user:

sudo apt-get install git-core cmake g++ libboost-dev libmysqlclient-dev libxml2-dev libmcrypt-dev libicu-dev openssl build-essential binutils-dev libcap-dev libgd2-xpm-dev zlib1g-dev libtbb-dev libonig-dev libpcre3-dev autoconf libtool libcurl4-openssl-dev libboost-system-dev libboost-program-options-dev libboost-filesystem-dev wget memcached libreadline-dev libncurses-dev libmemcached-dev libbz2-dev libc-client2007e-dev php5-mcrypt php5-imagick libgoogle-perftools-dev libcloog-ppl0 libelf-dev libdwarf-dev

Getting HipHop source-code

mkdir dev
cd dev
git clone git://github.com/facebook/hiphop-php.git
cd hiphop-php
export CMAKE_PREFIX_PATH=`/bin/pwd`/../usr
export HPHP_HOME=`/bin/pwd`
export HPHP_LIB=`/bin/pwd`/bin
export USE_HHVM=1
cd ..

Building third-party libraries

libevent

git clone git://github.com/libevent/libevent.git
cd libevent
git checkout release-1.4.14b-stable
cat ../hiphop-php/src/third_party/libevent-1.4.14.fb-changes.diff | patch -p1
./autogen.sh
./configure --prefix=$CMAKE_PREFIX_PATH
make
make install
cd ..

libCurl

Make sure that your system time is correct, otherwise ./configure will fail.

git clone git://github.com/bagder/curl.git
cd curl
cat ../hiphop-php/src/third_party/libcurl-7.22.1.fb-changes.diff | patch -p1
./buildconf
./configure --prefix=$CMAKE_PREFIX_PATH
make
make install
cd ..

libmemcached

wget http://launchpad.net/libmemcached/1.0/0.49/+download/libmemcached-0.49.tar.gz
tar -xzvf libmemcached-0.49.tar.gz
cd libmemcached-0.49
./configure --prefix=$CMAKE_PREFIX_PATH
make
make install
cd ..

(optional) JEMalloc 3.0

wget http://www.canonware.com/download/jemalloc/jemalloc-3.0.0.tar.bz2
tar xjvf jemalloc-3.0.0.tar.bz2
cd jemalloc-3.0.0
./configure --prefix=$CMAKE_PREFIX_PATH
make
make install
cd ..

Building HipHop

cd hiphop-php
git submodule init
git submodule update
export HPHP_HOME=`pwd`
export HPHP_LIB=`pwd`/bin
cmake .
make

hphp binary can be found in src/hphp folder and is called hphp hhvm binary can be found in src/hhvm folder and is called hhvm

If any errors occur, it may be required to remove the CMakeCache.txt directory in the checkout.

If your failure was on the @make@ command, try to correct the error and run @make@ again, it should restart from the point it stops. If don't, try to remove as explained above.