Skip to content

Building and installing HHVM on CentOS 6.3

360buyliulei edited this page Jul 29, 2012 · 27 revisions

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

Packages installation

sudo yum install git svn cpp make autoconf automake libtool patch memcached gcc-c++ cmake wget boost-devel mysql-devel pcre-devel gd-devel libxml2-devel expat-devel libicu-devel bzip2-devel oniguruma-devel openldap-devel readline-devel libc-client-devel libcap-devel binutils-devel pam-devel elfutils-libelf-devel

libmcrypt

Although CentOS doesn't provide libmcrypt, we can borrow from another repo and get the files we need.

mkdir dev
cd dev
wget 'ftp://rpmfind.net/linux/epel/beta/6/x86_64/libmcrypt-devel-2.5.8-9.el6.x86_64.rpm'
wget 'ftp://rpmfind.net/linux/epel/beta/6/x86_64/libmcrypt-2.5.8-9.el6.x86_64.rpm'
sudo rpm -i libmcrypt-*.rpm

Getting HipHop source-code

git clone -b vm 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 ..

tbb and libdwarf

As of this writing, libdwarf is not available with CentOS 6.3, and the version of libtbb is much too old. Both these packages also suffer the problem of not having install targets, so getting them on your system is a bit more cumbersome.

tbb

wget 'http://threadingbuildingblocks.org/uploads/77/187/4.0%20update%205/tbb40_20120613oss_src.tgz'
tar -zxf tbb40_20120613oss_src.tgz
cd tbb40_20120613oss
make

sudo mkdir -p /usr/include/serial
sudo cp -a include/serial/* /usr/include/serial/

sudo mkdir -p /usr/include/tbb
sudo cp -a include/tbb/* /usr/include/tbb/

sudo cp build/linux_intel64_gcc_cc4.4.6_libc2.12_kernel2.6.32_release/libtbb.so.2 /usr/lib64/
sudo ln -s /usr/lib64/libtbb.so.2 /usr/lib64/libtbb.so
cd ..

The exact path to your generated libtbb.so.2 may be slightly different depending on your version of gcc, libc, and the kernel, but that should be close.

libdwarf

git clone git://libdwarf.git.sourceforge.net/gitroot/libdwarf/libdwarf
cd libdwarf/libdwarf
./configure
make
sudo cp libdwarf.a /usr/lib64/
sudo cp libdwarf.h /usr/include/
sudo cp dwarf.h /usr/include/
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.

Clone this wiki locally