Skip to content

Building and installing HHVM on Amazon Linux 2013.09.1

ptarjan edited this page Mar 20, 2014 · 24 revisions

Dependencies

sudo yum -y update && \
sudo yum -y install \
	autoconf \
	automake \
	binutils-devel \
	boost-devel \
	bzip2-devel \
	chrpath \
	cmake \
	cpp \
	curl-devel \
	elfutils-libelf-devel \
	expat-devel \
	gcc47-c++ \
	gd-devel \
	git \
	jemalloc-devel \
	libIDL-devel \
	libc-client-devel \
	libcap-devel \
	libevent-devel \
	libicu-devel \
	libmcrypt-devel \
	libmemcached-devel \
	libtool \
	libxml2-devel \
	make \
	memcached \
	mysql-devel \
	oniguruma-devel \
	openldap-devel \
	pam-devel \
	patch \
	pcre-devel \
	readline-devel \
	svn \
	wget \
;

Checkout HHVM and submodules

cd ~ && \
git clone git://github.com/facebook/hhvm.git && \
cd hhvm && \
git checkout HHVM-2.4.1 && \
git submodule init && \
git submodule update && \
export CMAKE_PREFIX_PATH=`pwd`/.. && \
cd ..

Intel Thread Building Blocks (tbb) (4.0 or newer)

This build of Amazon Linux only has TBB 2.x available, so we need to compile a newer version from source.

wget https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb42_20130725oss_src.tgz && \
tar zxvf tbb42*.tgz && \
cd tbb42* && \
cd src && \
make && \
cd .. && \
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*/libtbb.so.2 /usr/lib64/ && \
sudo ln -s /usr/lib64/libtbb.so.2 /usr/lib64/libtbb.so && \
cd ..

libDwarf

As per issue #1337: Only the 20120410 tag seems to work.

git clone git://libdwarf.git.sourceforge.net/gitroot/libdwarf/libdwarf && \
cd libdwarf/libdwarf && \
git checkout 20120410 && \
./configure && \
make && \
sudo cp libdwarf.a /usr/lib64/ && \
sudo cp libdwarf.h /usr/include/ && \
sudo cp dwarf.h /usr/include/ && \
cd ../..

Google glog

wget https://google-glog.googlecode.com/files/glog-0.3.3.tar.gz && \
tar zxvf glog-0.3.3.tar.gz && \
svn checkout http://google-glog.googlecode.com/svn/trunk/ google-glog && \
cd google-glog && \
./configure --prefix=/usr && \
make && \
sudo make install && \
cd ..

Building HHVM

Refreshing library cache

sudo ldconfig

Compiling and installing

cd hhvm && \
cmake . && \
make && \
sudo make install

Updating HHVM (Nightly builds/master)

Do this if you would like to taste HHVM in its latest flavor. This will pull all updates from the master branch. This may have significant bugs & issues that are being worked on. Since the dependencies are already built, we just need to update and recompile HHVM itself.

cd ~/hhvm && \
git reset --hard HEAD && \
git checkout master && \
git pull --rebase origin && \
git submodule update --init && \
export CMAKE_PREFIX_PATH=`pwd`/.. && \
cmake . && \
make && \
sudo make install

Running HHVM on Amazon EC2

t1.micro

Because of its low memory, if you want to run HHVM on a t1.micro instance, you'll need to add the following to your config.hdf file (#1129):

Eval {
    JitASize = 134217728
    JitAStubsSize = 134217728
    JitGlobalDataSize = 67108864
}

Beefier instance types don't have this issue, although it would still be a good idea to tweak your settings for your instance type.

Clone this wiki locally