Skip to content

Building and installing HHVM on Debian 7

Josh Watzman edited this page May 1, 2015 · 36 revisions

Outdated

Building HHVM on Debian 7 is no longer supported; we require GCC 4.8, which is newer than the included version. You'll need to build gcc yourself, see below.

Packages installation

sudo apt-get install git-core automake cmake gawk libmysqlclient-dev \
  libxslt1.1 libxml2-dev libmcrypt-dev libicu-dev openssl build-essential binutils-dev \
  libcap-dev zlib1g-dev libtbb-dev libonig-dev libpcre3-dev \
  autoconf libtool libcurl4-openssl-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 libunwind7-dev subversion \
  libtbb2 libtbb-dev libjemalloc-dev \
  libc6-dev libmpfr4 libgcc1 binutils \
  libc6 libc-dev-bin libc-bin libgomp1 \
  libstdc++6 cmake \
  libarchive12 cmake-data libacl1 libattr1 \
  g++ cpp gcc make libgd2-xpm-dev \
  pkg-config libdwarf-dev binutils-dev \
  libmagickwand-dev libxslt1-dev libevent-dev libyaml-dev gperf

Build gcc

HHVM requires gcc 4.8 at least, and wheezy only has 4.7. The easiest thing to do is to build a new version and install into /usr/local.

sudo apt-get install libgmp-dev libmpfr-dev libmpc-dev
wget http://www.netgull.com/gcc/releases/gcc-4.9.2/gcc-4.9.2.tar.gz
tar xvf gcc-4.9.2.tar.gz
mkdir gcc-build
cd gcc-build
../gcc-4.9.2/configure --enable-languages=c,c++ --disable-multilib
make
sudo make install

Build ocaml

Hack support requires at least OCaml 4.01, so we need to build a newer version than 3.12 which ships with the OS.

wget http://caml.inria.fr/pub/distrib/ocaml-4.02/ocaml-4.02.1.tar.gz
tar xvf ocaml-4.02.1.tar.gz
cd ocaml-4.02.1
./configure
make world.opt
sudo make install

Getting HipHop source-code

mkdir dev
cd dev
git clone git://github.com/facebook/hhvm.git --depth=1
export CMAKE_PREFIX_PATH=`pwd`
cd hhvm
git submodule update --init --recursive
cd ..

Building third-party libraries

Google glog

svn checkout http://google-glog.googlecode.com/svn/trunk/ google-glog
cd google-glog
./configure --prefix=$CMAKE_PREFIX_PATH
make
make install
cd ..

Boost

As of HHVM 3.8, we require a newer version of boost (1.50) than wheezy has (1.49).

wget http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.bz2/download -O boost_1_55_0.tar.bz2
tar xvf boost_1_55_0.tar.bz2
cd boost_1_55_0/
./bootstrap.sh --without-libraries=python --prefix=$CMAKE_PREFIX_PATH
./b2 variant=release threading=multi link=static --layout=tagged
./b2 variant=release threading=multi link=static --layout=tagged install

Building HipHop

cd hhvm
cmake .
(optional) export LD_LIBRARY_PATH=/usr/local/lib64/
make

Running programs

The hhvm binary can be found in hphp/hhvm/hhvm.

The Hack language

See https://github.com/facebook/hhvm/wiki/Building-the-Hack-Typechecker.

Errors

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.

Clone this wiki locally