Installation of HHVM on ARM64 distributions

This page contains a collection of instructions and hints when compiling HHVM on ARM64 distributions.

Building HHVM in general

To create a release build run this command:
git clone git://github.com/facebook/hhvm.git
cd hhvm
git submodule update --init --recursive
cmake -DCMAKE_C_FLAGS="$COMPILER_FLAGS" -DCMAKE_CXX_FLAGS="$COMPILER_FLAGS" -DCMAKE_ASM_FLAGS="$COMPILER_FLAGS" $CMAKE_FLAGS .
make -j$(nproc)
The $CMAKE_FLAGS can be set if necessary. For example to create a debug build set this variable as follows before using the build instructions above:
CMAKE_FLAGS="$CMAKE_FLAGS -DCMAKE_BUILD_TYPE=Debug"

HHVM ARM64 on Ubuntu Xenial

To build HHVM ARM64 on Ubuntu Xenial (16.04) just follow the official instructions from the HHVM documentation (Link).

Notes

Note, that there exists an issue with gold's workaround for a Cortex A53 core. This can be addressed in two ways: 1) disable the workaround or 2) disable gold. The workaround can be disabled with the following flag:
COMPILER_FLAGS="$COMPILER_FLAGS -mno-fix-cortex-a53-835769"
To disable gold the following flag can be used:
CMAKE_FLAGS="$CMAKE_FLAGS -DENABLE_LD_GOLD=Off"

HHVM ARM64 on Fedora 25

Installation of distribution deps

sudo dnf 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 \
	gperf \
	glog-devel \
	inotify-tools-devel \
	double-conversion-devel \
	lz4-devel \
	fastlz-devel \
	libzip-devel \
	readline-devel \
	fribidi-devel \
	libvpx-devel \
	gmp-devel \
	re2-devel

Installation of non-distribution deps

The package jemalloc needs to be compiled from source, because the provided version of Fedora 25 (arm64) prints unexpected warning messages.

Installation of libjemalloc

Download the jemalloc 4.3.1 source tarball and issue the following command:
autoreconf -vfi ; ./configure --prefix=/usr/local/ ; make ; sudo make install

Notes

Note, that we've observed issues with gold on this system, so we recommend to disable it:
CMAKE_FLAGS="$CMAKE_FLAGS -DENABLE_LD_GOLD=Off"

HHVM ARM64 on CentOS 7

Installation of distribution deps

sudo yum -y update ; sudo yum -y install \
   autoconf \
   automake \
   binutils-devel \
   bzip2-devel \
   chrpath \
   cpp \
   curl-devel \
   elfutils-libelf-devel \
   expat-devel \
   fribidi-devel \
   gcc-c++ \
   gd-devel \
   git \
   glibc-devel \
   gmp-devel \
   gperftools-libs \
   libIDL-devel \
   libcap-devel \
   libevent-devel \
   libgcc \
   libicu-devel \
   libmemcached-devel \
   libmpc-devel \
   libstdc++-devel \
   libtool \
   libtool-ltdl-devel \
   libvpx-devel \
   libxml2-devel \
   libyaml-devel \
   make \
   memcached \
   mpfr-devel \
   mysql-devel \
   ncurses-devel \
   ocaml \
   openldap-devel \
   pam-devel \
   patch \
   pcre-devel \
   readline-devel \
   svn \
   wget \
   libxslt-devel \
   ImageMagick-devel

Installation of non-distribution deps

Since May 8 2017 the HHVM source requires GCC 4.9 or later. CentOS's ships with GCC 4.8, therefore GCC needs to be compiled from source. The packages cmake, oniguruma, libmcrypt, boost, libglog and jemalloc need to be compiled from source, because they are either outdated or not available.

External software (not covered by the system's package manager) is usually installed to /usr/local. In CentOS 7 this location is not considered by the runtime linker unless it is configured to do so. This configuration can be achieved by creating the file /etc/ld.so.conf.d/libc.conf with two lines: /usr/local/lib and /usr/local/lib64. After that configuration change, the following command makes the change take effect: ldconfig. Additionally the following line should be added in ~/.bash_profile: export PATH=/usr/local/bin:$PATH.

Installation of gcc

Download the gcc 5.4.0 source tarball and issue the following command:
./configure --prefix=/usr/local/ ; make ; sudo make install

Installation of cmake

Download the cmake 3.6.2 source tarball and issue the following command:
./bootstrap --prefix=/usr/local/ ; make ; sudo make install

Installation of oniguruma

Clone the git repository and checkout the git tag v6.3.0. Replace 1.14 by 1.13 in line 6 of configure.ac. Then issue the following command:
autoreconf -vfi ; ./configure --prefix=/usr/local/ ; make ; sudo make install

Installation of libmcrypt

Download the libmcrypt 2.5.8 source tarball and issue the following command:
autoreconf -vfi ; ./configure --prefix=/usr/local/ ; make ; sudo make install

Installation of boost

Download the boost 1.60 source tarball and issue the following command:
./bootstrap.sh --prefix=/usr/local ; sudo ./b2 install

Installation of libglog

Clone the git repository and checkout v0.3.4. Then issue the following command:
autoreconf -vfi ; ./configure --prefix=/usr/local ; make ; sudo make install

Installation of libjemalloc

Download the jemalloc 4.3.1 source tarball and issue the following command:
autoreconf -vfi ; ./configure --prefix=/usr/local/ ; make ; sudo make install

Notes

In order to use the built compiler for the hhvm build process, this CMake flags have to be set:
CMAKE_FLAGS="$CMAKE_FLAGS -DCMAKE_C_COMPILER=aarch64-unknown-linux-gnu-gcc"
CMAKE_FLAGS="$CMAKE_FLAGS -DCMAKE_CXX_COMPILER=aarch64-unknown-linux-gnu-g++"
COMPILER_FLAGS="$COMPILER_FLAGS -D_GLIBCXX_USE_CXX11_ABI=0"

HHVM ARM64 on OpenSUSE LEAP 42

Installation of distribution deps

zypper install \
   autoconf \
   automake \
   binutils-devel \
   libbz2-devel \
   chrpath \
   cpp \
   libcurl-devel \
   libelf-devel \
   libexpat-devel \
   fribidi-devel \
   gcc-c++ \
   gcc5 \
   gcc5-c++ \
   gd-devel \
   git \
   gmp-devel \
   gperf \
   gperftools-devel \
   libidl-devel \
   libcap-devel \
   libevent-devel \
   libicu-devel \
   libmemcached-devel \
   libtool \
   libltdl7 \
   libvpx-devel \
   libxml2-devel \
   libyaml-devel \
   make \
   memcached \
   ocaml \
   openldap2-devel \
   pam-devel \
   patch \
   pcre-devel \
   readline-devel \
   wget \
   libxslt-devel \
   ImageMagick-devel \
   cmake \
   oniguruma-devel \
   libmcrypt-devel \
   boost_1_61-devel \
   glog-devel \
   jemalloc-devel \
   tbb-devel \
   libdwarf-devel \
   libopenssl-devel \
   ocaml-ocamlbuild-devel \
   krb5-devel \
   libjpeg8-devel

Notes

Since May 8 2017 the HHVM source required you to have a GCC new than 4.8 in order get a successful build. OpenSUSE's gcc is version 4.8, therefore you need to install a later version of gcc (already included in the list above) and configure cmake to use that:
CMAKE_FLAGS="$CMAKE_FLAGS -DCMAKE_C_COMPILER=gcc-5 -DCMAKE_CXX_COMPILER=g++-5"