compile hiphop-php under openSUSE 11.3 64bit

Since there're comments to debian, ubuntu and RedHat only on the official website of hiphop-php I document the necessary steps to compile hiphop-php from source within openSUSE here. Please note the build page in their wiki. I'll refer to it later.

Set up your build environment

I'll use /home/user/hiphop as my builddir in this example. You can store the needed files wherever you want.Make sure you have a C++-Compiler installed. Also CMake is necessary. The make tool and git may already be installed.

zypper in gcc-c++ cmake make binutils git

Get hiphop-php

You have to get the sources now because they include a diff-file which is needed later.Hiphop-php uses a git repository, so make sure you have git installed. Go to your builddir and get hiphop-php:

cd /home/user/hiphop
git clone git://github.com/facebook/hiphop-php.git

This will create a folder hiphop-php inside your builddir.

Collect the needed libraries

Mostly you can use distro's standard libs but some you have to collect your own. Beside the libraries the headers of many are needed, too. So in openSUSE install the libpackage and libpackage-devel packages. This will install all needed libs and devel packages (hopefully):

zypper in boost boost-devel flex bison re2c libmysqlclient16 libmysqlclient-devel libxml2 libxml2-devel\
libmcrypt libmcrypt-devel libicu libicu-devel libopenssl1_0_0 libopenssl-devel binutils-devel libcap1\
libcap2 libcap-devel gd gd-devel zlib zlib-devel pcre pcre-devel libpcre0 libpcrecpp0 libpcreposix0\
libexpat1 libexpat-devel libbz2-1 libbz2-devel libreadline6 readline-devel

This was the easy part.

Download and unpack further dependencies

Unpack all Downloads into your builddir. It should look like /home/user/hiphop/libevent-1.4.13-stable and so on.

Patch curl and libevent

Make sure you haven't missed a step since the patches came with source of hiphop-php.Inside the builddir do:

cd libevent-1.4.13-stable
cp ../hiphop-php/src/third_party/libevent-1.4.13.fb-changes.diff .
patch -p1 < libevent-1.4.13.fb-changes.diff
cd ..

cd curl-7.21.2
cp ../hiphop-php/src/third_party/libcurl.fb-changes.diff .
patch -p1 < libcurl.fb-changes.diff
cd ..

Build dependencies and install them in your builddir

Now it's time to compile and install the stuff: We don't install it in the system but in your builddir instead. Beside hiphop-php you should have five directories: curl-7.21.2, libevent-1.4.13-stable, libmemcached-0.44, onig-5.9.1, tbb30_20101215oss. With e.g. curl we are doing:

cd curl-7.21.2
./configure --prefix=/hone/user/hiphop
make && make install
cd ..

Do the same with the rest of four! This will create new directories in your builddir (bin, include, lib, share).

troublemaker libc-client

There's a package "libc-client2007e_suse" in the repos. But it's compiled against some PAM-stuff I don't know. That's why you can't use it. So you have to get the sources patch and build it yourself without PAM. It doesn't matter later because php only uses the client functionality. Only IMAP-servers bind to PAM usually.

The c-client library comes with the UW IMAP tools. Download the tools and unpack it to the builddir. You have to edit the Makefile to turn the possibility of shared libraries on and add an extra make target. I use vi as an editor.

cd imap-2007e
vi Makefile

Goto line 255: Change extra flags like this:

EXTRACFLAGS=-fPIC

Goto line 407: Add the following target (I called it lsuclient) right behind the lsu target (lsu stands for linux suse):

lsuclient: an
$(BUILD) BUILDTYPE=lnx IP=$(IP6) \
  SPECIALS="SSLINCLUDE=/usr/include/openssl SSLLIB=/usr/lib64 SSLCERTS=/usr/share/ssl/certs SSLKEYS=/usr/share/ssl/private GSSDIR=/usr/kerberos"

Save and quit the editor.

Now you can compile the sources. The Makefile will only create a static version of libc-client. We will create a shared one. There's no install target so you have to do it manually but it's only one file that needs to be copied to your libs.

make lsuclient
cd c-client
gcc -shared -o libc-client.so *.o
mv libc-client.so ../../lib/libc-client.so
cd ../..

Compile hiphop-php

You have to set the right environment variables to your builddir, fine tune git and then you can compile. Just follow my lead:

export CMAKE_PREFIX_PATH=/home/user/hiphop
cd $CMAKE_PREFIX_PATH
cd hiphop-php
git submodule init
git submodule update
export HPHP_HOME=`pwd`
export HPHP_LIB=`pwd`/bin
cmake .
cd ..

If everything goes well you can start the compiling itself:

cd hiphop-php
make

Now you can use hiphop-php...

Trouble-shooting

If you have any question consult the official build page. Read and understand what they are doing. If you have comments specific to building under openSUSE please leave them here.

Geben Sie einen Kommentar ab

Kommentare

  • @Rogier: I'm not sure about src/ because a lot changed since HHVM came up.

    Johannes

    Erstellt von Johannes Nohl, 24/08/2013 2:45pm (vor 5 Jahre)

  • there doesn't seem to be a src dir inside hiphop-php so the cp and patching won't work.

    Erstellt von Rogier, 31/07/2013 11:01am (vor 5 Jahre)

  • Sorry for too many comments... German is not my language ;) hehe

    Erstellt von Hamster, 24/08/2011 3:40pm (vor 7 Jahre)

  • Stuck on c-client and found your post... thanks mate.

    Erstellt von Hamster, 24/08/2011 3:39pm (vor 7 Jahre)

RSS Feed für die Kommentare auf dieser Seite | RSS feed für alle Kommentare