Saturday, June 26, 2010

How to install Tokyo Cabinet

Mikio Hirabayashi lists the steps of installing Tokyo Cabinet.

Following the instruction, the installation is quite straight forward. As Tokyo Cabinet depends on zlib and bzip2, we need to install these two packages first. I am using zlib-1.2.5 and bzip2-1.0.5, however, after installing these two packages, I encountered an error during the 'make' phrase of Tokyo Cabinet installation:

/usr/bin/ld: /usr/local/lib/libbz2.a(bzlib.o): relocation R_X86_64_32S against `.text' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libbz2.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [] Error 1

Go back to the bzip2 directory, edit the Makefile, append " -fPIC" to the CFLAGS line:
CFLAGS=-Wall -Winline -O2 -g $(BIGFILES)

Reinstall the bzip2 ('make clean' and 'make install')
And then redo the Tokyo Cabinet installation. Now it should succeed.
Good luck~