On Tue, 11 Mar 2008, Bill Janssen wrote:
- a libjcc.dylib shared library
To build this, simply enter this in the shell after building JCC
itself (on leopard intel mac, adapt for other platforms until I
automate this in JCC's setup.py)
g++ -dynamiclib -install_name
/Library/Python/2.5/site-packages/JCC-1.8-py2.5-macosx-10.5-i386.egg/jcc/libjcc.dylib
-o libjcc.dylib build/temp.macosx-10.5-i386-2.5/jcc/sources/jcc.o
build/temp.macosx-10.5-i386-2.5/jcc/sources/JCCEnv.o -undefined dynamic_lookup
cp -p libjcc.dylib
/Library/Python/2.5/site-packages/JCC-1.8-py2.5-macosx-10.5-i386.egg/jcc/
So, I built this on Linux with
% g++ -shared -o libjcc.so ./build/temp.linux-i686-2.5/jcc/sources/jcc.o
./build/temp.linux-i686-2.5/jcc/sources/JCCEnv.o
% sudo cp -p libjcc.so
/usr/lib/python2.5/site-packages/JCC-1.8-py2.5-linux-i686.egg/jcc/
Then, I rebuilt PyLucene with the --shared switch and installed it.
When I try to start it up, I get
% python
Python 2.5 (r25:51908, Apr 10 2007, 10:29:13)
[GCC 4.1.2 20070403 (Red Hat 4.1.2-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import lucene
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/usr/lib/python2.5/site-packages/lucene-2.3.1-py2.5-linux-i686.egg/lucene/__init__.py",
line 2, in <module>
import os, _lucene
ImportError: libjcc.so: cannot open shared object file: No such file or
directory
%
If I'm reading the JCC Python code correctly, the shared library
should be installed in the same directory where _jcc.so is installed,
and should have the name "libjcc.<shext>", where <shext> is the shared
library extension for the platform. Is that correct? If so, I'm not
sure why I'm seeing this error, because
% ls /usr/lib/python2.5/site-packages/JCC-1.8-py2.5-linux-i686.egg/jcc/
config.py cpp.pyc _jcc.py libjcc.so python.py
config.pyc __init__.py _jcc.pyc libjcc.so.1 python.pyc
cpp.py __init__.pyc _jcc.so libjcc.so.1.8 sources
%
I do not have LD_LIBRARY_PATH set. When I do set it, things work.
Apparently on this platform, the thing to do is to somehow tell the
lucene extension where the JCC shared library is supposed to be, and
have that put on the load path. I believe the correct way to do this
is to use the "-rpath" flag to the linker when building _lucene.so.
Yes, that's the answer to your question. On Linux, you need to use -rpath to
get the _lucene.so to find libjcc.so or set LD_LIBRARY_PATH.
You can include that in the LFLAGS in JCC's setup.py.
(just like is done for libjava.so)
Andi..
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev