Skip to content

Install on Ubuntu system 16.10 (Experimental)

Rogerio Alves edited this page Jan 30, 2017 · 3 revisions

Warning: This is experimental and HHVM do not officially support's Ubuntu 16.10. Try it at your own risk.

Packages Installation

Using sudo or as root user: (it is recommended that you run sudo apt-get update and sudo apt-get upgrade first, or you may receive errors)

sudo apt-get install git-core gawk cmake gcc 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 php php7.0-mcrypt php-imagick libgoogle-perftools-dev \
libgoogle-glog-dev libelf-dev libdwarf-dev subversion python-software-properties \
libmagickwand-dev libxslt1-dev libevent-dev gawk \
libyaml-dev gperf libevent-dev libboost1.61-all-dev libiberty-dev libxslt1-dev libsqlite3-dev \
libyaml-dev libgmp3-dev gperf libkrb5-dev libnotify-dev libevent-dev libmagickwand-dev \
libinotifytools0-dev libiconv-hook-dev libedit-dev libjemalloc-dev libmcrypt-dev \
libmemcached-dev libmysqlclient-dev libncurses-dev libboost-system-dev libboost-thread-dev \
libboost-context-dev libbz2-dev libc-client-dev libldap2-dev \
libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-regex-dev \
liblz4-dev

Install OCAML

In order to use hack you need to install ocaml. Ubuntu 16.04 doesn't have a .deb package so you need to install it from the repository:

Clone the repository and enter the directory.

# git clone https://github.com/ocaml/ocaml.git
# cd ocaml

Run configure script. By default it will install be installed on /usr/local but you can install it at another location using prefix option:

# ./configure --prefix /usr

Run make (Important: do not run parallel instances (-j parameter) as the build may fail):

# make world.opt

There is a test suite. And yes, it is 'make tests', not 'test' or 'check'. Does not work with parallel jobs.

# make tests

Now you can install.

# make install

In order to compile hack typechecker you need to compile and install ocamlbuild and the native compiler. OCamlbuild was distributed as part of the OCaml distribution for OCaml versions between 3.10.0 and 4.02.3. Starting from OCaml 4.03, it is now released separately.

First clone the repository:

git clone https://github.com/ocaml/ocamlbuild

and then configure:

make configure OCAML_NATIVE=true

and finally install:

make && make install

Getting HHVM source-code

mkdir dev
cd dev
git clone -b next git://github.com/PPC64/hhvm.git --depth=1
export CMAKE_PREFIX_PATH=`pwd`

Building HHVM

cd hhvm
git submodule update --init --recursive
cmake .
make

Note: You can specify the build type using -DCMAKE_BUILD_TYPE=. The supported options are: Debug, Release, RelWithDebInfo. Default is Release

Troubleshoting

If any errors occur you can do a make clean and remove the CMakeCache.txt and, CMakeFiles folder from checkout directory and start build again.

-Wmisleading-indentation warnings (Lots)

Why it happens?

This is a new warning introduced on GCC 6 and can find things like goto fail errors. But seems that hhvm will need to do a huge refactor to fix those warnings. See more details at https://github.com/facebook/hhvm/issues/7439

How to fix

The best thing for now is disable this warning by using -Wno-misleading-indentation. See https://gcc.gnu.org/gcc-6/porting_to.html

Create a fix-warnings.patch and copy the following patch:

diff --git a/CMake/HPHPCompiler.cmake b/CMake/HPHPCompiler.cmake
index d18b39a..ee58982 100644
--- a/CMake/HPHPCompiler.cmake
+++ b/CMake/HPHPCompiler.cmake
@@ -111,6 +111,7 @@ if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQU
       "unused-local-typedefs"
       "deprecated-declarations"
       "unused-function"
+      "misleading-indentation"
     )
     list(APPEND DISABLED_C_NAMED_WARNINGS
       "old-style-declaration"

Now change directory to hhvm root folder and apply the patch: patch -p1 < fix-warnings.patch

Error: unknown array size in delete on third-party/re2

You may get the following error when try to build third-party/re2:

hhvm/third-party/re2/src/re2/dfa.cc: In constructor ‘re2::DFA::State::State()’:
hhvm/third-party/re2/src/re2/dfa.cc:95:10: error: unknown array size in delete
   struct State {

Why it happens?

This happens on gcc 6.1 > version due a GCC regression. See details at https://github.com/google/re2/issues/102

How to fix

Create a dfa.patch file and copy the following patch:

diff --git a/re2/dfa.cc b/re2/dfa.cc
index 483f678..b887424 100644
--- a/re2/dfa.cc
+++ b/re2/dfa.cc
@@ -101,7 +101,7 @@ class DFA {
     uint flag_;         // Empty string bitfield flags in effect on the way
                         // into this state, along with kFlagMatch if this
                         // is a matching state.
-    std::atomic<State*> next_[];    // Outgoing arrows from State,
+    std::atomic<State*> next_[0];    // Outgoing arrows from State,
                         // one per input byte class
   };

Now change directory to third-party/re2/src and apply the patch: patch -p1 < dfa.patch

Fatal error on boost/context/fcontext.hpp

If you are using boost 1.60 > you may get the following error:

In file included from hhvm/third-party/folly/src/folly/fibers/FiberManagerInternal.h:35:0,
                 from hhvm/third-party/folly/src/folly/fibers/FiberManager.cpp:16:

fatal error: boost/context/fcontext.hpp: No such file or directory
 #include <boost/context/fcontext.hpp>

Why it happens?

Well new boost version do i have to say anything else?

How to fix

They already fix it on upstream just get the commit patch below:

wget https://github.com/facebook/folly/commit/0b894c40e54e645bf1da19bcb9a28147ee2ce2b4.patch
mv 0b894c40e54e645bf1da19bcb9a28147ee2ce2b4.patch folly.patch

Then change to directory third-party/folly/ and apply the patch:

patch -p1 < ~/folly.patch

Error: PIC register clobbered by ‘r30’ in ‘asm’

This error occurs only on PPC64.

hhvm/hphp/runtime/base/heap-scan.h:303:3: error: PIC register clobbered by ‘r30’ in ‘asm’

Why this happens?

We can't clobber r30 register. The r30 is used under some special arcane circumstance. The problem is that error was not being caught by gcc older versions.

How to fix

Apply this patch:

diff --git a/hphp/util/portability.h b/hphp/util/portability.h
index 4b7d2a2..58375c4 100644
--- a/hphp/util/portability.h
+++ b/hphp/util/portability.h
@@ -185,7 +185,7 @@
   #define CALLEE_SAVED_BARRIER()\
     asm volatile("" : : : "r2", "r14", "r15", "r16", "r17", "r18", "r19",\
         "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28",   \
-        "r29", "r30", "cr2", "cr3", "cr4", "v20", "v21", "v22", "v23",   \
+        "r29", "cr2", "cr3", "cr4", "v20", "v21", "v22", "v23",   \
         "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31");
 #elif defined (__AARCH64EL__)
   #define CALLEE_SAVED_BARRIER()\