Skip to content

Building and Installing HHVM on Cygwin

DeniR edited this page Sep 4, 2014 · 13 revisions

Cygwin Build

Cygwin builds still use windows APIs. Only Windows 7 64bit and higher is supported. For now, HHVM must run inside the cygwin terminal.

The cygwin build does NOT have fastcgi, jemalloc or tcmalloc support right now. The zend_compat extension also does not currently build.

First you need to install cygwin. You must install the 64 bit version

http://cygwin.com/setup-x86_64.exe

Do not deselect any default packages. In addition you will need to install

Binaries

  • git
  • cmake
  • g++ (NOT the cygwin-32 version and NOT the mingw version)
  • make
  • cygserver (usually in a base install, but you need to run cygserver-config afterwards - this is necessary for sysv queue support)
  • ocaml
  • pkg-config

For building deps

  • wget (under web)
  • patch
  • automake-1.11 (the version is important)
  • automake-1.13 (the version is important for making hhvm)

Dependencies

  • libboost-devel
  • libiconv-devel
  • libpcre-devel
  • libevent-devel
  • libcurl-devel
  • libxml2-devel
  • libxslt-devel
  • libexpat-devel
  • libmcrypt-devel
  • libbz2-devel
  • openldap-devel
  • libreadline-devel
  • libedit-devel
  • libelf-devel
  • libonig-devel
  • libintl-devel
  • libcrypt0devel
  • libjpeg-devel
  • libpng-devel
  • libfreetype-devel
  • libvpx-devel
  • libgmp-devel
  • libMagick-devel
  • libllvm-devel

Then accept any dependencies that come along for the ride

Getting hhvm source

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

Next you'll need to build 4 libraries

  1. glog
  2. libdwarf
  3. libmemcached
  4. tbb (thread building blocks)

Three of these will need a patch applied. Two patches are from Yet Another Cygwin Ports, and one allows tbb to build and run on cygwin.

Building glog

wget https://code.google.com/p/google-glog/downloads/detail?name=glog-0.3.3.tar.gz
tar -zxvf glog-0.3.3.tar.gz
wget https://raw.githubusercontent.com/fd00/yacp/495c0be0dc3dc9ba4ba23ee91966e9494e3afb85/glog/glog-0.3.3-1bl2.src.patch
cd glog-0.3.3
patch -p2 < ../glog-0.3.3-1bl2.src.patch
./configure && make && make install
cd ..

Building libmemcached

wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
tar -zxvf libmemcached-1.0.18.tar.gz
wget https://raw.githubusercontent.com/fd00/yacp/ca6dc369c2eec5f9a31d2e436b88a759a50c9439/libmemcached/libmemcached-1.0.18-1bl1.src.patch
cd libmemcached-1.0.18
patch -p2 < ../libmemcached-1.0.18-1bl1.src.patch
./configure && make && make install
cd ..

Building libdwarf

wget http://www.prevanders.net/libdwarf-20140805.tar.gz
tar -zxvf libdwarf-20140805.tar.gz
cd dwarf-20140805
./configure && make
cd ..

Ignore any errors you get - libdwarf builds properly even if the other dwarf tools do not, you want the items that build in the libdwarf directory

Libdwarf does NOT have a proper install step, you'll need to copy libdwarf.h and dwarf.h to /usr/local/include/libdwarf and libdwarf.a to /usr/local/lib

Building tbb (thread building blocks)

You should build this parallel to your hhvm checkout from above, or change the line applying the patch

wget https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb42_20140601oss_src.tgz
tar -zxvf tbb42_20140601oss_src.tgz
cd tbb42_20140601oss
cat ../hhvm/hphp/patches/win32-cygwin-tbb-4.2-20140601oss.patch | patch -p1
make
cd ..

Like libdwarf there is not automatic "install" step. You'll need to copy the directory from /include/tbb to /usr/local/include/tbb for your include files, and then copy libtbb.dll, libtbbmalloc.dll and libtbbmallocproxy.dll to /usr/local/bin

Building HHVM

Please ensure that your machine has more than 1GB of RAM

cd hhvm
cmake .
make -j [number_of_processor_cores] # eg. make -j 4
make install

If you see "TBB not found error", change TEST_TBB_LIBRARY:FILEPATH=NOT FOUND to TEST_TBB_LIBRARY:FILEPATH=/usr/local/bin in hhvm/CMakeCache.txt

If you want to build a debug version of hhvm (probably very useful on cygwin)

cd hhvm
cmake -DCMAKE_BUILD_TYPE=Debug .
make -j [number_of_processor_cores] # eg. make -j 4
make install

When you configure - some libraries will be marked as not found, this is normal LIBINOTIFY LIBSQLITE3 (will use bundled) DOUBLE_CONVERSION (will use bundled) LZ4 (will use bundled)

Clone this wiki locally