1175: PyLucene Installation

jge****@gmai***** (Google Code) (Is this you? Claim this profile.)
Jan. 4, 2010
What's the URL of the page containing the problem?
http://www.review-board.org/docs/manual/dev/admin/installation/linux/#installing-pylucene

Describe the problem and any recommendations below.
The installation instructions for pylucene on older ubuntu versions seems
to be incorrect

This post helped, but it wasn't complete.
first:
http://seeknuance.com/2008/12/09/building-pylucene-for-review-board-on-ubuntu-hardy/

The steps I followed were:
1) Install all needed packages
sudo apt-get install zip unzip gcc g++ sun-java6-jdk ant python-dev
easy_install -U setuptools

2) Pull down and extract PyLucene
wget
http://downloads.osafoundation.org/PyLucene/jcc/PyLucene-2.4.0-2-src-jcc.tar.gz
tar -xfz PyLucene-2.4.0-2-src-jcc.tar.gz

3) Try to install JCC (this will fail) to get the super helpful error message:
python setup.py install

4) Do exactly what the error message says to patch easy_install (these will
vary)
mkdir tmp
cd tmp
unzip -q /usr/lib/python2.5/site-packages/setuptools-0.6c9-py2.5.egg
patch -Nup0 < /root/PyLucene-2.4.0-2/jcc/jcc/patches/patch.43
zip /usr/lib/python2.5/site-packages/setuptools-0.6c9-py2.5.egg -f
cd ..
rm -rf tmp

5) Tweak the setup.py script to fix issues w/ java (openjdk instead of sun)
(this is long, notice all the 'linxu2' entries say java-6-sun not
java-6-openjdk):

INCLUDES = {
    'darwin':
['/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers'],
    'ipod': ['/usr/include/gcc/darwin/default'],
    'linux2': ['/usr/lib/jvm/java-6-sun/include',
               '/usr/lib/jvm/java-6-sun/include/linux'],
    'sunos5': ['/usr/jdk/instances/jdk1.6.0/include',
               '/usr/jdk/instances/jdk1.6.0/include/solaris'],
    'win32': ['o:/Java/jdk1.6.0_02/include',
              'o:/Java/jdk1.6.0_02/include/win32'],
}

CFLAGS = {
    'darwin': ['-fno-strict-aliasing'],
    'ipod': ['-Wno-write-strings'],
    'linux2': ['-fno-strict-aliasing', '-Wno-write-strings'],
    'sunos5': ['-features=iddollar',
               '-erroff=badargtypel2w,wbadinitl,wvarhidemem'],
    'win32': [],
}

# added to CFLAGS when JCC is invoked with --debug
DEBUG_CFLAGS = {
    'darwin': ['-O0', '-g', '-DDEBUG'],
    'ipod': ['-O0', '-g', '-DDEBUG'],
    'linux2': ['-O0', '-g', '-DDEBUG'],
    'sunos5': ['-DDEBUG'],
    'win32': ['/Od', '/DDEBUG'],
}

LFLAGS = {
    'darwin': ['-framework', 'JavaVM', '-framework', 'Python'],
    'ipod': ['-ljvm', '-lpython%s.%s' %(sys.version_info[0:2]),
             '-L/usr/lib/gcc/arm-apple-darwin9/4.0.1'],
    'linux2/i386': ['-L/usr/lib/jvm/java-6-sun/jre/lib/i386', '-ljava',
                    '-L/usr/lib/jvm/java-6-sun/jre/lib/i386/client', '-ljvm',
                   
'-Wl,-rpath=/usr/lib/jvm/java-6-sun/jre/lib/i386:/usr/lib/jvm/java-6-sun/jre/lib/i386/client'],
    'linux2/i686': ['-L/usr/lib/jvm/java-6-sun/jre/lib/i386', '-ljava',
                    '-L/usr/lib/jvm/java-6-sun/jre/lib/i386/client', '-ljvm',
                   
'-Wl,-rpath=/usr/lib/jvm/java-6-sun/jre/lib/i386:/usr/lib/jvm/java-6-sun/jre/lib/i386/client'],
    'linux2/x86_64': ['-L/usr/lib/jvm/java-6-sun/jre/lib/amd64', '-ljava',
                      '-L/usr/lib/jvm/java-6-sun/jre/lib/amd64/server',
'-ljvm',
                     
'-Wl,-rpath=/usr/lib/jvm/java-6-sun/jre/lib/amd64:/usr/lib/jvm/java-6-sun/jre/lib/amd64/server'],
    'sunos5': ['-L/usr/jdk/instances/jdk1.6.0/jre/lib/i386', '-ljava',
               '-L/usr/jdk/instances/jdk1.6.0/jre/lib/i386/client', '-ljvm',
              
'-R/usr/jdk/instances/jdk1.6.0/jre/lib/i386:/usr/jdk/instances/jre/lib/i386/client'],
    'win32': ['/LIBPATH:o:/Java/jdk1.6.0_02/lib', 'jvm.lib'],
}


6) Install JCC again:
python setup.py install

7) Go up a level and tweak the Makefile:
Uncomment the stuff after "# Linux     (Ubuntu 8.10 64-bit, Python 2.5.2,
OpenJDK 1.6, setuptools 0.6c9)"
I changed NUM_FILES=2 to NUM_FILES=50 so that it wasn't crunching such a
huge CPP file

8) make (this will take a LONG time)

9) make install

Then you should be good to go.
david
#1 david
I added a note in 55afd01. Thanks!
  • +Fixed