-
Notifications
You must be signed in to change notification settings - Fork 3k
Building and Installing HHVM on Cygwin
Cygwin support (and Windows support in general) is nowhere near complete. Don't expect HHVM to even get anywhere close to building on Windows. These directions are for anyone interested in taking on the (monumental) task of continuing the Windows port.
Note: You must have the 64Bit version of Cygwin to be able to build HHVM.
Note: make -j 4
command throughout the guide assumes that you have 4 CPU cores in your computer. If that's not the case, please replace 4 with the number of CPU Cores in your Computer.
It's advised to do a fresh install of Cygwin to avoid any conflicts and problems. Cygwin install instructions can be found on it's offical website
As you progress thrugh the Cygwin installation, Do not deselect any base packages. In addition to the base packages You need the wget
and git
packages.
To install the dependencies you're gonna need Apt-Cyg. However you can install them one by one in the GUI if you prefer.
apt-cyg install gcc-g++ cmake make ocaml pkg-config automake1.11 automake1.13 \
patch wget 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 libcrypt-devel \
libjpeg-devel libpng-devel libfreetype-devel libvpx-devel libgmp-devel libMagick-devel \
libllvm-devel libmysqld-devel libkrb5-devel
git clone git://github.com/facebook/hhvm.git
cd hhvm
git checkout HHVM-3.4.2
git submodule update --init --recursive
- glog
- libdwarf
- libmemcached
- tbb (thread building blocks)
wget https://google-glog.googlecode.com/files/glog-0.3.3.tar.gz
tar -zxvf glog-0.3.3.tar.gz
cd glog-0.3.3
wget -q -O - https://raw.githubusercontent.com/fd00/yacp/495c0be0dc3dc9ba4ba23ee91966e9494e3afb85/glog/glog-0.3.3-1bl2.src.patch | patch -p2
./configure --prefix=/usr && make -j 4 && make install
cd ..
Don't forget to edit the number of cores
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
cd libmemcached-1.0.18
wget -q -O - https://raw.githubusercontent.com/fd00/yacp/ca6dc369c2eec5f9a31d2e436b88a759a50c9439/libmemcached/libmemcached-1.0.18-1bl1.src.patch | patch -p2
./configure --prefix=/usr && make -j 4 && make install
cd ..
wget http://www.prevanders.net/libdwarf-20140805.tar.gz
tar -zxvf libdwarf-20140805.tar.gz
cd dwarf-20140805
./configure --prefix=/usr && make -j 4
cd libdwarf && mkdir /usr/include/libdwarf && cp libdwarf.h dwarf.h /usr/include/libdwarf && cp libdwarf.a /usr/lib && cd ..
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
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
wget -q -O - https://gist.github.com/steelbrain/ab15d4bd8ea84250a41e/raw/3593ba1ac939b581df5fa4062d094dee45260e82/TBB_Cygwin.patch | patch -p1
make
cp include/tbb /usr/include/tbb -R
cd build/cygwin_intel64_gcc_cc4.9.2_newlib_release && cp libtbb.dll libtbbmalloc.dll libtbbmallocproxy.dll /usr/bin && cp libtbb.dll.a libtbbmalloc.dll.a libtbbmallocproxy.dll.a /usr/lib && cd ../../
cd ..
There're some conflicts between Winsock2 and NetDB. To resolve them, we have to patch a event.h and event2/utils.h
cd /usr/include
wget -q -O - https://gist.github.com/steelbrain/ab15d4bd8ea84250a41e/raw/1b02b900739d949af852caae12fb5e421cddc1e3/Event_h.patch | patch -p1
HHVM and It's deps aren't made for Windows. So we have to patch some parts of it to make it work. This section assumes that you are in the HHVM repo dir.
cd /path/to/hhvm
wget -q -O - https://gist.github.com/wjywbs/a417b98644dc9d6fdc85/raw/a3cfea0b1cc05ee5c3f1d2263573ba9bc52ceae2/fastcgi_main.diff | patch -p1
wget -q -O - https://gist.github.com/wjywbs/a417b98644dc9d6fdc85/raw/209c7fd3c883a5e0b5e6c20945a4306415973840/hhvm_hack.diff | patch -p1
wget -q -O - https://gist.github.com/wjywbs/a417b98644dc9d6fdc85/raw/6624727cc91a0665e92dedb1d41431d2e77efe9c/hhvm_main.diff | patch -p1
cd third-party
wget -q -O - https://gist.github.com/wjywbs/a417b98644dc9d6fdc85/raw/ea61e26f76f3f9c181a725f0d79ff956c9d3bdce/fastcgi_third_party.diff | patch -p1
cd thrift/src
wget -q -O - https://gist.github.com/wjywbs/a417b98644dc9d6fdc85/raw/0daab58cb8138402419166fb39e585f25de04946/fastcgi_thrift.diff | patch -p1
cd ../../
cd folly/src
wget -q -O - https://gist.github.com/wjywbs/a417b98644dc9d6fdc85/raw/1a37af2931d3444cd795061fae982546360691c0/fastcgi_folly.diff | patch -p1
wget -q -O - https://gist.github.com/wjywbs/a417b98644dc9d6fdc85/raw/2d35ae42cafcb6448c1ac0a132736c3f857d6b57/hhvm_folly.diff | patch -p1
cd ../../
wget -q -O - https://gist.github.com/wjywbs/a417b98644dc9d6fdc85/raw/84b314a1d3e3e02d43bffcc8ffa0f2bebe444f64/hhvm_third_party.diff | patch -p1
Please ensure that your machine has more than 1GB of RAM
cd path/to/hhvm
cmake .
wget -q -O - https://gist.github.com/steelbrain/ab15d4bd8ea84250a41e/raw/a003fc86489092b7228febc8d1258c359a4c0d62/CMakeCache.patch | patch -p1
cmake .
nano hphp/hhvm/CMakeFiles/hhvm.dir/link.txt # You should append `-ltbb -L/usr/bin` to the first line
make -j 4
make install
If you want to build a debug version of hhvm (probably very useful on cygwin), Your cmake command should look like this.
cmake -DCMAKE_BUILD_TYPE=Debug .
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)