Hello Andi, all,

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.

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.

Reply via email to