How-to: Install HipHop (PHP to C++ translator) on Ubuntu 9.10

HipHop has been developed on CentOS and Fedora, building on Ubuntu 9.10 is experimental. At the moment, HipHop can only run on 64 bits systems. The following information about installing hiphop is provided by Facebook’s HipHop wiki.

Packages installation

Using sudo or as root user:

sudo apt-get install git-core cmake g++ libboost-dev flex bison re2c libmysqlclient-dev libxml2-dev libmcrypt-dev libicu-dev openssl binutils-dev libcap-dev libgd2-xpm-dev zlib1g-dev libtbb-dev libonig-dev libpcre3-dev git-core autoconf libtool libcurl4-openssl-dev libboost-system-dev libboost-program-options-dev libboost-filesystem-dev

Getting HipHop source-code

mkdir hiphop
cd hiphop
git clone git://github.com/facebook/hiphop-php.git
cd hiphop-php
export CMAKE_PREFIX_PATH=`/bin/pwd`/../
export HPHP_HOME=`/bin/pwd`
export HPHP_LIB=`/bin/pwd`/bin
git submodule init
git submodule update
cd ..

Building third-party libraries

libevent

wget http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz
tar -xzvf libevent-1.4.13-stable.tar.gz
cd libevent-1.4.13-stable
cp ../hiphop-php/src/third_party/libevent.fb-changes.diff .
patch < libevent.fb-changes.diff
./configure --prefix=$CMAKE_PREFIX_PATH
make
make install
cd ..

ICU4

wget http://download.icu-project.org/files/icu4c/4.2.1/icu4c-4_2_1-src.tgz
tar -xvzf icu4c-4_2_1-src.tgz
cd icu/source
./configure --prefix=$CMAKE_PREFIX_PATH
make
make install
cd ../../

libCurl

Make sure that your system time is correct, otherwise ./configure will fail.

wget http://curl.haxx.se/download/curl-7.20.0.tar.gz
tar -xvzf curl-7.20.0.tar.gz
cd curl-7.20.0
cp ../hiphop-php/src/third_party/libcurl.fb-changes.diff .
patch -p0 < libcurl.fb-changes.diff
./configure --prefix=$CMAKE_PREFIX_PATH
make
make install
cd ..

Building HipHop

cd hiphop-php
cmake .
make

Now, we have successfully compiled HipHop! The next post will contain information about using HipHop (compiling PHP code in various modes and circumventing some of HipHop’s limitations).

  1. karthick says:

    Does this hold good for ubuntu 9.01 systems. Mine is 32 bit. Build has been done and I am not able to execute the compiler now. in /usr/local/bin hphp file is missing. Is this due to my build break or its not supported to 32 bit. I have configured hiphop compiler using http://littlewhitetwo.blogbus.com/logs/68330170.html this link.
    Cmake output:

    oot@classle-desktop:~/hiphop/hiphop-php# cmake .
    – Configuring done — Generating done
    – Build files have been written to: /root/hiphop/hiphop-php
    Make output:

    [ 17%] Building C object mbfl/CMakeFiles/mbfl.dir//filters/
    mbfilter_iso8859_15.c.o [ 18%] Building C object mbfl/CMakeFiles/
    mbfl.dir//filters/mbfilter_iso8859_16.c.o Linking C static library
    libmbfl.a
    [100%] Built target mbfl

    System Spec:
    Ubuntu 9.04
    32 bit Linux machine
    Php 5.1 Version and apache2

    After doing this,I tried to execute a php script . script is in src
    directory
    root@classle-desktop:~/hiphop/hiphop-php/src# hphp/hphp test.php
    bash: hphp/hphp: is a directory
    Clarifications needed:
    It seems that hiphop is not installed properly.Can some please help me
    on this?. Would I have missed anything??.Are my logs are right.? i
    have seen in some blogs that ubuntu doesnot support hiphop as of now?.
    any mistakes due to the 32 bit version. because packages are built
    only for Centos and debian??

  2. admin says:

    Unfortunately, Hiphop does not support 32 bit operating systems. See also the official Hiphop wiki:
    http://github.com/facebook/hiphop-php/wiki/Building-and-Installing-on-Ubuntu-9.10

Leave a Reply