[pylucene-dev] Re: PyLucene install errors [was: JCC install errors]

Andi Vajda vajda at osafoundation.org
Thu Feb 14 09:38:53 PST 2008


On Feb 14, 2008, at 6:48, Alessandro Magni <magni at inrim.it> wrote:

> The ongoing problems continue:
>
> 1) I've been able to build/installed JCC, thanks to my (surprising!)  
> discovery that I needed Sun's version of Java

Surprising ??

>
>
> Having installed it / setup the java alternatives, it worked by  
> modifying the setup.py lines:
>
> INCLUDES = {
> ...
>   'linux2': ['/usr/lib/jvm/java-1.6.0-sun-1.6.0.04/include/',
>               '/usr/lib/jvm/java-1.6.0-sun-1.6.0.04/include/linux'],
> ...
> }
>
> LFLAGS = {
> ...
>   'linux2': [ '-L/usr/lib/jvm/java-1.6.0-sun-1.6.0.04/lib/i386:/usr/ 
> java/jdk1.6.0_04/jre/lib/i386/',
>                '-Wl,-rpath=/usr/lib/jvm/java-1.6.0-sun-1.6.0.04/lib/ 
> i386:/usr/lib/jvm/java-1.6.0-sun-1.6.0.04/lib/i386
> /client:/usr/java/jdk1.6.0_04/jre/lib/i386/'],
> ...
> }
>
> notice that I removed '-ljava' from LFLAGS - with it it didnt work:  
> libjava.so not found, even if I have it in the indicated paths:
> -rwxr-xr-x 1 root root 185K Dec 14 10:32 /usr/java/jdk1.6.0_04/jre/ 
> lib/i386/libjava.so

Removing -ljava is going to cause the  problem you reported below.
>
> ... anyway, it compiled/installed, so why complain?

Yeah, complaining is not going to help either way.

>
> 2) Then, I'vre removed one stumbling block from the PyLucene Makefile:
> my problem was that "make" gave the result:
>
> ...
> /usr/src/PyLucene-2.3.0-1/lucene-java-2.3.0/common-build.xml:474:  
> Unable to find a javac compiler;
> com.sun.tools.javac.Main is not on the classpath.
> Perhaps JAVA_HOME does not point to the JDK.
> It is currently set to "/usr/java/jdk1.6.0_04/jre"
> ...
>
> while, in fact, that variable is correct:
> echo $JAVA_HOME
> /usr/lib/jvm/java-1.6.0-sun-1.6.0.04/bin
>
>
> Inspired by the "WINDOWS" section, I modified (in "linux2") the line  
> so:
>
> ANT=JAVA_HOME=/usr/lib/jvm/java-1.6.0-sun-1.6.0.04;ant

Just as was suggested yesterday on this list. But, normally, you  
shouldn't have to set JAVA_HOME at all. Ant can figure it out. Then,  
maybe on redhat or on your install, it can't, in which case setting it  
can work that around but without 'bin'.

>
> don't ask me why, but now the compile proceed much more (could you  
> maybe update the Makefile with this change?)
>
>
> BUT - it's not finished yet:
>
> after working a lot, the make process stops here:
>
> CFLAGS="" /usr/bin/python -m jcc --jar lucene-java-2.3.0/build/ 
> lucene-core-2.3.0.jar --jar lucene-java-2.3.0/build/contrib/snowball/ 
> lucene-snowball-2.3.0.jar --jar lucene-java-2.3.0/build/contrib/ 
> highlighter/lucene-highlighter-2.3.0.jar --jar lucene-java-2.3.0/ 
> build/contrib/analyzers/lucene-analyzers-2.3.0.jar --jar lucene- 
> java-2.3.0/build/contrib/regex/lucene-regex-2.3.0.jar --jar lucene- 
> java-2.3.0/build/contrib/queries/lucene-queries-2.3.0.jar --jar  
> build/jar/extensions.jar --package java.lang java.lang.System  
> java.lang.Runtime --package java.util java.text.SimpleDateFormat -- 
> package java.io java.io.StringReader java.io.InputStreamReader  
> java.io.FileInputStream --exclude  
> org.apache.lucene.queryParser.Token --exclude  
> org.apache.lucene.queryParser.TokenMgrError --exclude  
> org.apache.lucene.queryParser.QueryParserTokenManager --exclude  
> org.apache.lucene.queryParser.ParseException --python lucene -- 
> mapping org.apache.lucene.document.Document 'get:(Ljava/lang/String;) 
> Ljava/lang/String;' --mapping java.util.Properties 'getProperty: 
> (Ljava/lang/String;)Ljava/lang/String;' --sequence  
> org.apache.lucene.search.Hits 'length:()I' 'doc:(I)Lorg/apache/ 
> lucene/document/Document;' --version 2.3.0 --files 2 --build
> Traceback (most recent call last):
> File "/usr/lib/python2.5/runpy.py", line 95, in run_module
>   filename, loader, alter_sys)
> File "/usr/lib/python2.5/runpy.py", line 52, in _run_module_code
>   mod_name, mod_fname, mod_loader)
> File "/usr/lib/python2.5/runpy.py", line 32, in _run_code
>   exec code in run_globals
> File "/usr/lib/python2.5/site-packages/JCC-1.7-py2.5-linux-i686.egg/ 
> jcc/__init__.py", line 27, in <module>
>   from jcc import cpp
> File "/usr/lib/python2.5/site-packages/JCC-1.7-py2.5-linux-i686.egg/ 
> jcc/__init__.py", line 30, in <module>
>   from _jcc import initVM
> ImportError: /usr/lib/python2.5/site-packages/JCC-1.7-py2.5-linux- 
> i686.egg/jcc/_jcc.so: undefined symbol: JNI_GetDefaultJavaVMInitArgs
> make: *** [compile] Error 255
>

So you got ant to compile Lucene from sources. Now, you need to to  
back to setup.py and add -ljava back to LFLAGS and rebuild jcc. This  
missing symbol is in that libjava library you removed and jcc is not  
going to function without it.

> I don't understand the reason - I feel it may be related to my  
> erasing the '-ljava' line in the setup.py of JCC.
>
> What do you think about it?

You have the right feeling. If the jcc build failed with -ljava then  
you've probably got a bug in LFLAGS in the
-L flags which tell the linker where to find the libs.

Andi..

>
>
> Alessandro
>
> -- 
>
> ~~~ 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /  Dr.Alessandro Magni
> \        Electromagnetics Division
> /        INRiM Strada delle Cacce 91, 10135 Torino (ITALIA)
> \        Email magni at inrim.it
> /        Tel: 0039-011-3919821  Fax: 0039-011-3919834
> \        URL http://www.inrim.it/~magni
> / Our business in life is not to succeed but to continue to fail \  
> in high spirits.  -- Robert Louis Stevenson
> ~~~ 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>


More information about the pylucene-dev mailing list