Skip to content

Building and Installing on FreeBSD 8.2

dcicppin edited this page Feb 12, 2012 · 30 revisions

HipHop-PHP install in FreeBSD 8.2

You can try to build on any FreeBSD with gcc44 available, I've successfully built ot on 8.1, 8.2 and 9.0, all 64bit.

Fix before FreeBSD update

mkdir -p /usr/src/lib/libc/gen

Update FreeBSD

freebsd-update fetch

freebsd-update install

Add required packages to build HPHP and HPHPI

pkg_add -r cmake flex bison re2c openssl gd libxml2 pcre oniguruma boost-libs libmemcached libmcrypt binutils expat mysql50-client wget tbb icu openldap24-client libexecinfo gcc44 gawk git cclient mc

* gcc44 seems to be the most optimal option since other versions produce broken or buggy builds.

Fix for CClient 2007

cd /usr/local/lib
ln -s libc-client4.a libc-client.a
ln -s libc-client4.so libc-client.so
ln -s libc-client4.so.9 libc-client.so.9

Create a directory for build

mkdir ~/hhbuild
cd ~/hhbuild

Get the latest HipHop code

git clone git://github.com/facebook/hiphop-php.git
cd hiphop-php
git submodule init
git submodule update

Configure environment

You'll have to do this every time you're going to use HipHop.

export CC=/usr/local/bin/gcc44
export CXX=/usr/local/bin/g++44
export HPHP_HOME=`pwd`
export HPHP_LIB=`pwd`/bin

Build patched libevent

cd ..
fetch https://github.com/downloads/libevent/libevent/libevent-1.4.13-stable.tar.gz
tar -zxf libevent-1.4.13-stable.tar.gz
cd libevent-1.4.13-stable
patch -p1 < ../hiphop-php/src/third_party/libevent-1.4.13.fb-changes.diff
./configure
make
make install
cd ..
rm -rf libevent-1.4.13-stable

Build patched CURL

fetch http://curl.haxx.se/download/curl-7.20.0.tar.gz
tar -zxf curl-7.20.0.tar.gz
cd curl-7.20.0
patch -p1 < ../hiphop-php/src/third_party/libcurl.fb-changes.diff
./configure
make
make install
cd ..
rm -rf curl-7.20.0

Apply unofficial patches (until official fixes)

fetch http://cpp.in/dev/hphp-freebsd-20120211.patch
cd hiphop-php
patch < ../hphp-freebsd-20120211.patch

For FreeBSD 9.0 you need to download and apply additional libmemcached patch:

cd ..
fetch http://cpp.in/dev/hphp-libmemcached-1.0.patch
cd hiphop-php
patch < ../hphp-libmemcached-1.0.patch

Configure libmap

Since we're using new gcc, we should make HipHop use new libstdc++. Put this to /etc/libmap.conf:

[hphp]
libstdc++.so.6 gcc44/libstdc++.so.6

[hphpi]
libstdc++.so.6 gcc44/libstdc++.so.6

[program]
libstdc++.so.6 gcc44/libstdc++.so.6

Build HipHop

cmake .
make