Sunday June 07, 2009
Compiling Drizzle on OpenSolaris 2009.06
I thought it would be appropriate with a new and updated blog post on how to compile Drizzle with the release of OpenSolaris 2009.06. To make the blog more copy'n'paste friendly I have removed the prompt from all of the command's I am displaying :-)
The first thing we need to do is to install a complier, and all of the common tools used to build opensource projects. Drizzle also require libevent and gperf, and there exists precompiled packages for them. So let's go ahead and install the software with the following command:
pfexec pkg install ss-dev SUNWlibevent SUNWgnu-gperf
I like to put the software I compile in separate ZFS filesystems, so let's go ahead and create:
/opt/dscm - To hold the scm systems/opt/drizzle - This is where we want our Drizzle installation/opt/gearman - This is where we want our Gearman installation"Why not just put everything in /usr/local?" you may ask. Well, I don't like that because then I have a hard time figuring what files to remove when I want to uninstall a package. "This must turn into a long and complex path?" would probably be your next question. The answer is no. Just create the appropriate symbolic links and you are good to go :-)
So let's go ahead and create the ZFS filesystems:
for f in dscm drizzle gearman google do pfexec zfs create -o mountpoint=/opt/$f rpool/$f pfexec chown `/usr/bin/id -u`:`/usr/bin/id -g` /opt/$f done
Drizzle, Gearman and libmemcached all use Bazaar for development, and there isn't a package available for OpenSolaris so we need to install this ourself. The Bazaar team is really active and using the "release early, release often" model, and I want a easy way to keep up with the versions. Instead of having zombie files / versions laying around, I ended up with a model where I install each version into its own directory, and I have a symbolic link to the version I want to use. Because we install in a "nonstandard" location, we need to create a startup-script so that Python can find the modules. So let's go ahead and install Bazaar (1.15 is the latest stable version right now) :
wget --no-check-certificate http://launchpad.net/bzr/1.15/1.15final/+download/bzr-1.15.tar.gz gtar xfz bzr-1.15.tar.gz cd bzr-1.15 python setup.py install --prefix=/opt/dscm/bazaar-1.15 mkdir /opt/dscm/bin cat > /opt/dscm/bin/bzr <<EOF #! /bin/ksh export PYTHONPATH=/opt/dscm/bazaar/lib/python2.4/site-packages exec /opt/dscm/bazaar/bin/bzr "\$@" EOF chmod a+x /opt/dscm/bin/bzr ln -s bazaar-1.15 /opt/dscm/bazaar cd .. rm -rf bzr-1.15.tar.gz bzr-1.15
The next time you want to upgrade Bazaar, all you need to do is to move the symbolic link /opt/dscm/bazaar to point to the new version. You can now either put /opt/dscm/bin into your path, or you can create something like /opt/local/bin and create a symbolic link to /opt/dscm/bin/bzr from there (and then put /opt/local/bin in your path. To avoid path problems, I'll keep on referring to bzr with absolute path throughout the example.
For some reason OpenSolaris doesn't contain a prebuilt 64-bit version of GNU readline, so that we need to compile that ourself (It is scheduled for an upcoming build AFAIK). To keep the example simple, I'll just install the readline library into /opt/drizzle. So just execute the following commands to download, build and install:
wget http://ftp.gnu.org/gnu/readline/readline-6.0.tar.gz gtar xfz readline-6.0.tar.gz cd readline-6.0 ./configure --disable-static --prefix=/opt/drizzle gmake all install gmake clean ./configure --disable-static --prefix=/opt/drizzle --libdir=/opt/drizzle/lib/`isainfo -k` CFLAGS="-m64" gmake all install ln -s `isainfo -k` /opt/drizzle/lib/64 ln -s . /opt/drizzle/lib/32 cd .. rm -rf readline-6.0.tar.gz readline-6.0
Stop! why do you build it two times?" If you look at the options there I compile one version with "-m64", and that option will create a 64bit binary. Most people would probably not care for the 32bit binary, but I like to build both versions when I build a library (so that I don't have problems later on if I want to build a 32 (or 64 bit) binary using the library. The reason for the two symbolic links I create at the end is explained in chapter 32-bit and 64-bit Libraries.
Drizzle use Google Protocol buffers in the communication protocol, so let's go ahead and compile them. I don't use the latest version, because there is a compilation error in that version (and I haven't had the time to look at that yet):
wget http://protobuf.googlecode.com/files/protobuf-2.0.3.tar.gz
gtar xfz protobuf-2.0.3.tar.gz
cd protobuf-2.0.3
./configure --disable-static --with-zlib --prefix=/opt/google CPPFLAGS="-fast -m32" LDFLAGS="-fast" \
--bindir=/opt/google/bin/i86
gmake all install
gmake clean
./configure --disable-static --with-zlib --prefix=/opt/google CPPFLAGS="-fast -m64" LDFLAGS="-fast -m64" \
--libdir=/opt/google/lib/`isainfo -k` --bindir=/opt/google/bin/`isainfo -k`
gmake all install
cd ..
ln -s `isainfo -k` /opt/google/lib/64
ln -s . /opt/google/lib/32
cp /usr/lib/isaexec /opt/google/bin/protoc
rm -rf protobuf-2.0.3.tar.gz protobuf-2.0.3
With all the dependencies installed, we can go ahead and grab the source for libmemcached, libdrizzle, Gearman and Drizzle:
for f in libdrizzle gearmand libmemcached drizzle do /opt/dscm/bin/bzr branch lp:$f done
So let's go ahead and start building them. libdrizzle is first up:
cd libdrizzle ./config/autorun.sh ./configure --disable-static --prefix=/opt/drizzle CFLAGS="-fast -m32" LDFAGS="-fast" gmake all install ./configure --disable-static --prefix=/opt/drizzle --libdir=/opt/drizzle/lib/`isainfo -k` CFLAGS="-fast -m64" LDFAGS="-fast" gmake clean gmake all install cd ..
The next one on the list is libmemcached:
cd libmemcached
./config/bootstrap
PATH=$PATH:/usr/perl5/bin ./configure --disable-static --prefix=/opt/drizzle CFLAGS="-fast -m32" LDFAGS="-fast" \
--without-memcached --bindir=/opt/drizzle/bin/i86
gmake all install
PATH=$PATH:/usr/perl5/bin ./configure --enable-64bit --disable-static --prefix=/opt/drizzle \
--libdir=/opt/drizzle/lib/`isainfo -k` CFLAGS="-fast" LDFAGS="-fast" --without-memcached --bindir=/opt/drizzle/bin/`isainfo -k`
gmake clean
gmake all install
for f in memcat memrm memcp memerror memflush memslap memstat
do
cp /usr/lib/isaexec /opt/drizzle/bin/$f
done
cd ..
There is a problem with the configure script for Gearman, so it is not able to create a 32 bit binary on a machine capable of running in 64 bit mode, so from now on we will only create 64 bit binaries (I will work on a patch for this):
cd gearmand
./config/bootstrap
./configure --prefix=/opt/gearman --disable-static --sbindir=/opt/gearman/sbin/`isainfo -k` --libdir=/opt/gearman/lib/`isainfo -k` \
--bindir=/opt/gearman/bin/`isainfo -k` CFLAGS="-fast -I/opt/drizzle/include -m64" \
LDFLAGS="-L/opt/drizzle/lib/64 -R/opt/drizzle/lib/64"
gmake clean
gmake all install
cd ..
cp /usr/lib/isaexec /opt/gearman/sbin/gearmand
cp /usr/lib/isaexec /opt/gearman/bin/gearman
Before we can start compiling Drizzle we need to make sure that Drizzle can detect our PCRE installation. OpenSolaris ships with a version that is too new for the Drizzle configure script, so that we need to create a symbolic link to make sure it detects it properly:
pfexec ln -s pcre/pcre.h /usr/include/pcre.h
Now all is set for compiling Drizzle:
cd drizzle PATH=$PATH:/opt/dscm/bin ./config/autorun.sh PATH=$PATH:/opt/google/bin ./configure CPPFLAGS="-I/opt/google/include -I/opt/gearman/include -I/opt/drizzle/include" \ LDFLAGS="-L/opt/google/lib/64 -L/opt/gearman/lib/64 -L/opt/drizzle/lib/64 -R/opt/drizzle/lib/64:/opt/gearman/lib/64:/opt/google/lib/64" \ --prefix=/opt/drizzle --libdir=/opt/drizzle/lib/`isainfo -k` PATH=$PATH:/opt/google/bin gmake all install
Now you should have Drizzle installed in /opt/drizzle. If you look in some of my previous blog posts you should be able to find out how to install it as an SMF service :-)
Cheers
Posted at 08:41PM Jun 07, 2009 by trond in OpenSolaris | Comments[1]
| « January 2010 | ||||||
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 | ||||||
| Today | ||||||
Thanks for the tutorial. Good stuff!
I'm new to OpenSolaris and have a related question.
I'm trying to install an up-to-date Totem movie player without clobbering the existing copy. So, I'm installing to a custom directory: /export/home/cjpembo/.MY_TOTEM
The installed Totem uses:
gstreamer-0.10.24
gst-plugins-base-0.10.24
The newer Totem requires:
gstreamer-0.10.25
gst-plugins-base-0.10.25
So, I installed gstreamer-0.10.25 from source as follows:
export CC=suncc
export CFLAGS=-fast
./configure --prefix=/export/home/cjpembo/.MY_TOTEM
make
make install
(this works fine)
gst-plugins-base-0.10.25 relies on gstreamer-0.10.25
So, I again install from source using the same method as before. But, I cannot get the ./configure to use my new gstreamer; it always falls back to the older installed version. I've tried the following commands:
--libdir=/path/to/my/version/lib
--includedir=/path/to/my/version/include
CFLAGS="-I/path/to/my/version/include"
CFLAGS="-L/path/to/my/version/lib"
all with no results. It always finds the previous version.
I need to force it to use my new version in the non-standard location and ignore the installed version.
Any hints?
Thanks
Posted by Chris Pemberton on November 07, 2009 at 03:43 AM CET #