On Feb 14, 2008, at 7:08, "Alexandre Fiori" <[EMAIL PROTECTED]> wrote:


Hi Alessandro,

I don't think you really need all those modifications.

Well, usually, changes in jcc's setup.py are necessary in order to include and link the correct Java runtime.

In particular, if you set the rpath option in LFLAGS correctly, you shouldn't have to set LD_LIBRARY_PATH later when you're trying to run jcc or lucene.

Setting this variable is brittle and considered a security flaw.

Andi..


I've compiled latest pylucene-jcc 2.3.0 few days ago on ubuntu 7.10 by doing the following:

1. compiled and installed jcc without any modification
$ cd jcc ; python setup.py build ; sudo python setup.py install

2. on the main Makefile, removed comments of the lines below
# Linux     (Ubuntu 7.10 64-bit, Python 2.5.1, Java 1.6)
PREFIX_PYTHON=/usr
ANT=ant
PYTHON=$(PREFIX_PYTHON)/bin/python
JCC=$(PYTHON) -m jcc
NUM_FILES=2

3. $ make ; sudo make install


Nothing else. BUT, note that I have set LD_LIBRARY_PATH on /etc/ profile so it's valid for any user, including root as well. (don't forget to logout and login after changing /etc/profile, or set it by hand - you'll need it to be set when running sudo)
Here it is:
export LD_LIBRARY_PATH=/usr/lib/jvm/java-6-sun-1.6.0.03/jre/lib/ i386/:/usr/lib/jvm/java-6-sun-1.6.0.03/jre/lib/i386/client/: $LD_LIBRARY_PATH





On Thu, Feb 14, 2008 at 12:48 PM, Alessandro Magni <[EMAIL PROTECTED]> 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

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

... anyway, it compiled/installed, so why complain?


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


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



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?

Alessandro

--

~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/  Dr.Alessandro Magni
\        Electromagnetics Division
/        INRiM Strada delle Cacce 91, 10135 Torino (ITALIA)
\        Email [EMAIL PROTECTED]
/        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
~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev



--
Ship ahoy! Hast seen the While Whale?
 - Melville's Captain Ahab
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev

Reply via email to