Skip to content

Building and installing HHVM on OSX 10.8

Daniel Sloof edited this page Jul 20, 2013 · 72 revisions

As of yet, HHVM does not completely work on OSX. This page serves as a work in progress for getting it partially working.

Packages installation

Install homebrew.

Install the following packages with homebrew:

brew tap homebrew/dupes
brew install gettext cmake git libtool mcrypt glog oniguruma re2c autoconf libelf readline automake mysql pcre gd icu4c libmemcached mysql-connector-c pkg-config tbb boost imagemagick mysql-connector-c++ binutils ncurses curl

Install GCC:

brew tap homebrew/versions
brew install --enable-cxx --use-llvm gcc47

Install some packages that are not (yet) part of homebrew:

brew install https://gist.github.com/danslo/5841970/raw/9177250ed1a7466f0acf3147c9c1ca0ff8ab233b/cclient.rb \
    https://gist.github.com/danslo/5621394/raw/7826e6046bf77bea549265099c306debfcbe6b04/libdwarf.rb \
    https://gist.github.com/danslo/5841552/raw/12e593ac59478feb42ed435e30a18e269f2891a5/libeventfb.rb \
    https://gist.github.com/danslo/5881669/raw/8c5a05e01e89604a2e8af5fa25482e025a85b44f/boostfb.rb \
    https://gist.github.com/danslo/6034879/raw/00be8488d2dea232b750ab8207a788032d9135b6/jemallocfb.rb

Downgrade libmemcached due to this bug.

cd /usr/local
git checkout e029db5 Library/Formula/libmemcached.rb
brew unlink libmemcached
brew install libmemcached
brew switch libmemcached 1.0.4

Getting HipHop source-code

git clone git://github.com/facebook/hiphop-php.git

Building HipHop

cd hiphop-php
export HPHP_HOME=`pwd`
cmake . \
    -DCMAKE_CXX_COMPILER=$(brew --prefix gcc47)/bin/g++-4.7 \
    -DCMAKE_C_COMPILER=$(brew --prefix gcc47)/bin/gcc-4.7 \
    -DCMAKE_ASM_COMPILER=$(brew --prefix gcc47)/bin/gcc-4.7 \
    -DBINUTIL_LIB=$(brew --prefix binutils)/lib/x86_64/libiberty.a \
    -DCMAKE_INCLUDE_PATH="/usr/local/include:/usr/include" \
    -DCMAKE_LIBRARY_PATH="/usr/local/lib:/usr/lib" \
    -DLIBUNWIND_INCLUDE_DIR=/usr/include \
    -DLIBUNWIND_LIBRARY=/System/Library/Frameworks/System.framework/System \
    -DLIBEVENT_LIB=$(brew --prefix libeventfb)/lib/libevent.dylib \
    -DLIBEVENT_INCLUDE_DIR=$(brew --prefix libeventfb)/include \
    -DICU_INCLUDE_DIR=$(brew --prefix icu4c)/include \
    -DICU_LIBRARY=$(brew --prefix icu4c)/lib/libicuuc.dylib \
    -DICU_I18N_LIBRARY=$(brew --prefix icu4c)/lib/libicui18n.dylib \
    -DICU_DATA_LIBRARY=$(brew --prefix icu4c)/lib/libicudata.dylib \
    -DREADLINE_INCLUDE_DIR=$(brew --prefix readline)/include \
    -DREADLINE_LIBRARY=$(brew --prefix readline)/lib/libreadline.dylib \
    -DNCURSES_LIBRARY=$(brew --prefix ncurses)/lib/libncurses.dylib \
    -DCURL_INCLUDE_DIR=$(brew --prefix curl)/include \
    -DCURL_LIBRARY=$(brew --prefix curl)/lib/libcurl.dylib \
    -DBOOST_INCLUDEDIR=$(brew --prefix boostfb)/include \
    -DBOOST_LIBRARYDIR=$(brew --prefix boostfb)/lib \
    -DBoost_USE_STATIC_LIBS=ON \
    -DJEMALLOC_INCLUDE_DIR=$(brew --prefix jemallocfb)/include \
    -DJEMALLOC_LIB=$(brew --prefix jemallocfb)/lib/libjemalloc.dylib \
    -DLIBINTL_LIBRARIES=$(brew --prefix gettext)/lib/libintl.dylib \
    -DLIBINTL_INCLUDE_DIR=$(brew --prefix gettext)/include
make