lucene-pylucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roman Chyla <roman.ch...@gmail.com>
Subject Re: Problem loading jcc from java : undefined symbol: PyExc_IOError
Date Tue, 15 Feb 2011 01:40:07 GMT
On Tue, Feb 15, 2011 at 1:32 AM, Andi Vajda <vajda@apache.org> wrote:
>
> On Tue, 15 Feb 2011, Roman Chyla wrote:
>
>> The python embedded in Java works really well on MacOsX and also
>> Ubuntu. But I am trying hard to make it work also on Scientific Linux
>> (SLC5) with *statically* built Python. The python is a build from
>> ActiveState.
>
> You mean you're going to try to dynamically load libpython.a into a JVM ?
> I have no idea if this can work at all.

I am very ignorant as far as the difference between statically and
dynamically linked libraries go - I just wanted to use JCC wrapped
code with this particular statically linked python

I got little bit further, but just little:

after I changed -Xlinker --export-dynamic into "-Xlinker
-export-dynamic" (and installed python into /opt...) I am getting a
different error:

SEVERE: org.apache.jcc.PythonException: No module named solrpie.java_bridge
null
	at org.apache.jcc.PythonVM.instantiate(Native Method)
	at rca.python.jni.PythonVMBridge.start(Unknown Source)
	at rca.python.jni.PythonVMBridge.start(Unknown Source)
	at rca.python.jni.PythonVMBridge.start(Unknown Source)
	at rca.python.jni.SolrpieVM.getBridge(Unknown Source)


My understanding is that the previous error has gone (and the python
module "time" is loaded), because if I set PYTHONPATH incorrectly, I
get:
This message is IMHO coming from Python

But when I correct the PYTHONPATH, I am getting only this:

[java] Fatal Python error: Interpreter not initialized (version mismatch?)
[java] Java Result: 134



>
> If my understanding of static builds is correct, I'd imagine the only way
> for this to work would be to statically compile the JVM (hotspot) and python
> together.

oooups, that is way over my head

>
> But why all this ?

Because on the grid, we already had a statically linked python and it
was working very well with pylucene (and after all, I managed to make
it work also for solr and other packages)

But if you think that it is not possible, I should do something else :)
But it was fun trying, if you get some idea, please let me know.

Thank you,

  Roman

>
> Andi..
>
>> So far, I managed to build all the needed extensions (jcc, lucene,
>> solr) and I can run them in python, but when I try to start the java
>> app and use python, I get:
>>
>> SEVERE: org.apache.jcc.PythonException:
>>
>> /afs/cern.ch/user/r/rchyla/public/ActivePython-2.5.5.7-linux-x86_64/INSTALLDIR/lib/python2.5/lib-dynload/time.so:
>> undefined symbol: PyExc_IOError
>>
>>
>> I understand, that the missing symbol PyExc_IOError is in the static
>> python library:
>>
>> bash-3.2$ nm
>> /afs/cern.ch/user/r/rchyla/public/ActivePython-2.5.5.7-linux-x86_64/INSTALLDIR/lib/python2.5/config/libpython2.5.a
>> | grep IOError
>> 0000000000004120 D PyExc_IOError
>> 0000000000004140 d _PyExc_IOError
>>                U PyExc_IOError
>>                U PyExc_IOError
>>                U PyExc_IOError
>>                U PyExc_IOError
>>                U PyExc_IOError
>>                U PyExc_IOError
>>                U PyExc_IOError
>>
>> So when building JCC, I build with these arguments:
>>
>> lflags  +  ['-lpython%s.%s' %(sys.version_info[0:2]),
>> '-L',
>>
>> '/afs/cern.ch/user/r/rchyla/public/ActivePython-2.5.5.7-linux-x86_64/INSTALLDIR/lib/python2.5/config',
>> '-rdynamic',
>> '-Wl,--export-dynamic',
>> '-Xlinker',
>> '--export-dynamic']
>>
>> I just found instructions at:
>>
>> http://stackoverflow.com/questions/4223312/python-interpreter-embedded-in-the-application-fails-to-load-native-modules
>> I don't really understand g++, but the symbol is there after the
>> compilation
>>
>> bash-3.2$ nm
>> /afs/cern.ch/user/r/rchyla/public/ActivePython-2.5.5.7-linux-x86_64/INSTALLDIR/lib/python2.5/site-packages/JCC-2.7-py2.5-linux-x86_64.egg/libjcc.so
>> | grep IOError
>> 0000000000352240 D PyExc_IOError
>> 0000000000352260 d _PyExc_IOError
>>
>> And when starting java, I do
>>
>> "-Djava.library.path=/afs/cern.ch/user/r/rchyla/public/ActivePython-2.5.5.7-linux-x86_64/INSTALLDIR/lib/python2.5/site-packages/JCC-2.7-py2.5-linux-x86_64.egg"
>>
>> The code works find on mac (python 2.6) and ubuntu (python2.6), but
>> not this statically linked python2.5 - would you know what I can try?
>>
>> Thanks.
>>
>>
>>  roman
>>
>>
>> PS: I tried several compilations, but I was usually re-compiling JCC
>> without building lucene etc again, I hope that is not the problem.
>>
>

Mime
View raw message