Skip to content

Building and installing HHVM on OSX 10.10

Daniel Sloof edited this page Jul 31, 2015 · 38 revisions

Important: Work in Progress - Check back later.

The information here is for posterity and experimentation purposes. This is almost certainly not going to build right now, so don't get your hopes up.

Homebrew: Install by hand

Tap additional repositories

brew tap homebrew/versions

Install dependencies

brew install freetype gettext cmake git libtool mcrypt oniguruma re2c  \
             autoconf libelf readline automake pcre md5sha1sum \
             gd icu4c libmemcached pkg-config tbb imagemagick binutils \
             curl imap-uw libxslt libevent sqlite openssl glog boost   \
             coreutils homebrew/dupes/openldap gawk findutils

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

brew install \
  https://gist.githubusercontent.com/slbmeh/9059260/raw/1cbf0f6f5639b4a066395bedb702cdd6bd895d15/libdwarf.rb \
  https://gist.githubusercontent.com/sgolemon/8fdc7e2afcd73a960b9c/raw/1211e21151ed3443dbc027e5383fb49e9eb1ab91/jemallocfb.rb \
  https://gist.githubusercontent.com/danslo/7bfa0b8a33271ce0089d/raw/72dbc13c0608ac558520441e194f64630e97e213/binutilsfb.rb

Get a more recent copy of clang because the one that ships with OSX doesn't support thread_local.

brew install llvm36 --with-clang --rtti --with-libcxx

Get HHVM

git clone --recursive git://github.com/facebook/hhvm.git

Build HHVM

cd hhvm
cmake . \
    -DCMAKE_CXX_COMPILER=$(brew --prefix llvm36)/bin/clang++-3.6 \
    -DCMAKE_C_COMPILER=$(brew --prefix llvm36)/bin/clang-3.6 \
    -DCMAKE_ASM_COMPILER=$(brew --prefix llvm36)/bin/clang-3.6 \
    -DLIBIBERTY_LIB=$(brew --prefix binutilsfb)/lib/x86_64/libiberty.a \
    -DCMAKE_INCLUDE_PATH="/usr/local/include:/usr/include" \
    -DCMAKE_LIBRARY_PATH="/usr/local/lib:/usr/lib" \
    -DENABLE_MCROUTER=OFF \
    -DENABLE_EXTENSION_MCROUTER=OFF \
    -DMYSQL_UNIX_SOCK_ADDR=/tmp/mysql.sock \
    -DLIBEVENT_LIB=$(brew --prefix libevent)/lib/libevent.dylib \
    -DLIBEVENT_INCLUDE_DIR=$(brew --prefix libevent)/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 \
    -DCURL_INCLUDE_DIR=$(brew --prefix curl)/include \
    -DCURL_LIBRARY=$(brew --prefix curl)/lib/libcurl.dylib \
    -DBOOST_INCLUDEDIR=$(brew --prefix boost)/include \
    -DBOOST_LIBRARYDIR=$(brew --prefix boost)/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 \
    -DLIBDWARF_LIBRARIES=$(brew --prefix libdwarf)/lib/libdwarf.3.dylib \
    -DLIBDWARF_INCLUDE_DIRS=$(brew --prefix libdwarf)/include \
    -DLIBMAGICKWAND_INCLUDE_DIRS=$(brew --prefix imagemagick)/include/ImageMagick-6 \
    -DLIBMAGICKWAND_LIBRARIES=$(brew --prefix imagemagick)/lib/libMagickWand-6.Q16.dylib \
    -DFREETYPE_INCLUDE_DIRS=$(brew --prefix freetype)/include/freetype2 \
    -DFREETYPE_LIBRARIES=$(brew --prefix freetype)/lib/libfreetype.dylib \
    -DLIBMEMCACHED_LIBRARY=$(brew --prefix libmemcached)/lib \
    -DLIBMEMCACHED_INCLUDE_DIR=$(brew --prefix libmemcached)/include \
    -DLIBELF_LIBRARIES=$(brew --prefix libelf)/lib/libelf.a \
    -DLIBELF_INCLUDE_DIRS=$(brew --prefix libelf)/include/libelf \
    -DLIBGLOG_LIBRARY=$(brew --prefix glog)/lib/libglog.dylib \
    -DLIBGLOG_INCLUDE_DIR=$(brew --prefix glog)/include \
    -DOPENSSL_SSL_LIBRARY=$(brew --prefix openssl)/lib/libssl.dylib \
    -DOPENSSL_INCLUDE_DIR=$(brew --prefix openssl)/include \
    -DOPENSSL_CRYPTO_LIBRARY=$(brew --prefix openssl)/lib/libcrypto.dylib \
    -DPCRE_LIBRARY=$(brew --prefix pcre)/lib \
    -DPCRE_INCLUDE_DIR=$(brew --prefix pcre)/include \
    -DTBB_INSTALL_DIR=$(brew --prefix tbb) \
    -DLIBSQLITE3_INCLUDE_DIR=$(brew --prefix sqlite)/include \
    -DLIBSQLITE3_LIBRARY=$(brew --prefix sqlite)/lib/libsqlite3.0.dylib \
    -DLDAP_INCLUDE_DIR=$(brew --prefix openldap)/include \
    -DLDAP_LIBRARIES=$(brew --prefix openldap)/lib/libldap.dylib
make -j4 hhvm

Run Tests

brew install homebrew/php/php56
cd hphp
test/run test/quick

Macports: Install by Hand

Dependencies

sudo port -v install autoconf automake binutils bison boost clang-3.6 cmake elftoolchain gawk google-glog jemalloc libelf libjpeg-turbo libmcrypt libmemcached libpng md5sha1sum ocaml oniguruma5 readline tbb

Clone HHVM

git clone https://github.com/facebook/hhvm.git
cd hhvm
git submodule update --init --recursive

Build

cmake \
 -DCMAKE_C_COMPILER=clang-mp-3.6 -DCMAKE_CXX_COMPILER=clang++-mp-3.6 -DCMAKE_ASM_COMPILER=clang-mp-3.6 \
 -DCMAKE_C_FLAGS="-isystem/opt/local/include" -DCMAKE_CXX_FLAGS="-isystem/opt/local/include" \
 -DENABLE_MCROUTER=0 -DENABLE_EXTENSION_MCROUTER=Off -DENABLE_EXTENSION_IMAGICK=Off \
 -DMYSQL_UNIX_SOCK_ADDR=/dev/null \
 -DLIBDWARF_LIBRARIES="/opt/local/lib/elftoolchain/libdwarf.3.dylib" \
 -DLIBDWARF_INCLUDE_DIRS="/opt/local/include/elftoolchain/"

Run

DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib ./hphp/hhvm/hhvm --version

Clone this wiki locally