Skip to content

Building and installing HHVM on Amazon Linux 2016.03

Nando edited this page Jan 5, 2017 · 5 revisions

This process was tested against HHVM 3.14.1 on Amazon Linux 2016.03


Install Various Dependencies

Dependencies from Amazon Linux and EPEL

sudo yum-config-manager --enable epel && \
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 \
	gcc-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 \
	libxslt-devel \
	ImageMagick-devel \
	gmp-devel \
	gperf \
	libdwarf-devel \
	libedit-devel \
	libvpx-devel \
	libyaml-devel \
	libzip-devel \
	lz4-devel \
	numactl-devel \
	sqlite-devel \
	unixODBC-devel \
	fribidi-devel \
	fastlz-devel \
	enca \
	re2-devel \
	cmake3 \
;

OCaml

sudo yum-config-manager --add-repo http://download.opensuse.org/repositories/home:ocaml/CentOS_6/home:ocaml.repo
sudo yum -y install ocaml
sudo yum-config-manager --disable home_ocaml

Google glog

wget https://github.com/google/glog/archive/v0.3.4.tar.gz && \
tar zxvf v0.3.4.tar.gz && \
cd glog-0.3.4 && \
./configure --prefix=/usr && \
make && \
sudo make install && \
cd ..

Intel Threading Building Blocks (tbb) (>=4.)

sudo yum -y remove tbb tbb-devel && \
cd ~ && \
wget https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb44_20160526oss_src_0.tgz && \
tar zxvf tbb44*.tgz && \
cd tbb44* && \
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 ..

Checkout HHVM and submodules

cd ~ && \
git clone git://github.com/facebook/hhvm.git --depth=1 && \
cd hhvm && \
git checkout HHVM-3.14.1 && \
git submodule update --init --recursive && \

Building HHVM

Compiling and installing

cd ~/hhvm && \
cmake3 . && \
make -j$(($(nproc)+1)) && \
sudo make install

Alternatively compile with Zend Compat layer:

cd ~/hhvm && \
cmake3 -DENABLE_ZEND_COMPAT=ON . && \
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
}

Or the config.ini equivalent (not tested):

hhvm.eval.jit_a_size = 134217728
hhvm.eval.jit_a_stubs_size = 134217728
hhvm.eval.jit_global_data_size = 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