-
Notifications
You must be signed in to change notification settings - Fork 3k
Building and installing HHVM on Ubuntu 12.04
Using sudo or as root user: (you may have to run sudo apt-get update
first)
sudo apt-get install git-core gawk cmake g++ libmysqlclient-dev \
libxml2-dev libmcrypt-dev libicu-dev openssl build-essential binutils-dev \
libcap-dev libgd2-xpm-dev zlib1g-dev libtbb-dev libonig-dev libpcre3-dev \
autoconf automake 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 subversion python-software-properties \
libmagickwand-dev libxslt1-dev libevent-dev gawk \
libyaml-dev gperf
HHVM requires gcc >= 4.8.0, but Ubuntu 12.04 only ships with 4.6. To get a more recent version, follow these steps:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.8 g++-4.8
Then make gcc-4.8 the default compiler by updating the alternates db:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 40 \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.6
sudo update-alternatives --set gcc /usr/bin/gcc-4.8
Similarly, HHVM requires Boost 1.51, but Ubuntu 12.04 only ships with 1.48. To get a more recent version, follow these steps:
sudo add-apt-repository ppa:boost-latest/ppa
sudo apt-get update
sudo apt-get install libboost1.55-all-dev
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
mkdir dev
cd dev
git clone git://github.com/facebook/hhvm.git --depth=1
cd hhvm
git submodule update --init --recursive
export CMAKE_PREFIX_PATH=`pwd`/..
cd ..
Make sure that your system time is correct, otherwise ./configure will fail.
git clone git://github.com/bagder/curl.git --depth=1
cd curl
./buildconf
./configure --prefix=$CMAKE_PREFIX_PATH
make
make install
cd ..
svn checkout http://google-glog.googlecode.com/svn/trunk/ google-glog
cd google-glog
./configure --prefix=$CMAKE_PREFIX_PATH
make
make install
cd ..
Note: If you're not authenticated as the root user, use sudo make install
instead of make install
, or you will get problems on the cmake.
wget http://www.canonware.com/download/jemalloc/jemalloc-3.6.0.tar.bz2
tar xjvf jemalloc-3.6.0.tar.bz2
cd jemalloc-3.6.0
./configure --prefix=$CMAKE_PREFIX_PATH
make
make install
cd ..
Please ensure that your machine has more than 1GB of RAM
cd hhvm
cmake -DENABLE_MCROUTER=false .
make
The hhvm binary can be found in hphp/hhvm/hhvm
.
See https://github.com/facebook/hhvm/wiki/Building-the-Hack-Typechecker.
If any errors occur, it may be required to remove the CMakeCache.txt
file 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 CMake is complaining about libicu/ICU then you may need to build ICU manually before cmake
will run:
wget http://download.icu-project.org/files/icu4c/52.1/icu4c-52_1-src.tgz
tar -xzvf icu4c-52_1-src.tgz
cd icu/source
./configure --prefix=$CMAKE_PREFIX_PATH
make
sudo make install
Then delete the CMakeCache.txt
file in the hhvm directory if it exists to get a clean CMake run.