Skip to content

Building and installing HHVM on Fedora 19 or 20

Philipp Gampe edited this page Oct 8, 2015 · 13 revisions

Packages for building

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 libedit-devel libc-client-devel libcap-devel binutils-devel pam-devel elfutils-libelf-devel libmcrypt-devel libcurl-devel libmemcached-devel jemalloc-devel tbb-devel libdwarf-devel ImageMagick-devel libxslt-devel ocaml libevent-devel libyaml-devel readline-devel glog-devel libzip-devel lz4-devel sqlite-devel gmp-devel gperf libatomic

Getting HHVM source code and building

mkdir dev
cd dev
git clone git://github.com/facebook/hhvm.git --depth=1
export CMAKE_PREFIX_PATH=`pwd`
cd hhvm
# if git submodule fails because of tree error, then clone hhvm again without the --depth parameter
git submodule update --init --recursive
cmake .
make # Add -jN, with N being numcores+1 to maximize build performance.

Running programs

If running on a different machine, install runtime dependencies (probably incomplete below):

sudo yum install glog boost

The hhvm executable is hphp/hhvm/hhvm.

The Hack language

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

Fedora Service Daemon

To have HHVM start as a system daemon process on Fedora once you have complied HHVM you will want to create an hhvm service below you will find an example of a systemd file. This will allow you to start HHVM as a daemon by issuing service start and stop commands and enable HHVM to be run on boot.

Please note the that hhvm should be linked to or copied to /usr/bin for this script, a config file needs to exist at /etc/hhvm/hhvm.hdf, and user name for HHVM is apache which matches the Fedora default. This can be changed in the hhvm.service script to match your setup.

hhvm.service

[Unit]
Description=HipHop Virtual Machine

[Service]
ExecStart=/usr/bin/hhvm -m daemon -u apache -c /etc/hhvm/hhvm.hdf
ExecStop=rm /var/run/hhvm.pid
PIDFile=/var/run/hhvm.pid

[Install]
WantedBy=multi-user.target

Start HHVM

sudo systemctl start hhvm

Enable HHVM on boot

sudo systemctl enable hhvm
Clone this wiki locally