[sword-devel] Python and swig
pierre.amadio at libertysurf.fr
Fri Jan 26 04:24:08 MST 2007
Thanks to Bill and Ben for your feedback, it did help.
I did not manage to create the module following one of the method but i
did gather enough information from your input to be nearer my target :)
Some words about the background: yes, i m building stuff under linux.
I build things in scratchbox, the developpment plateform for maemo
application (the nokia internet tablet linux sdk):
The development environment is a sort of chroot environment where you
can either build stuff for i686 and launch apps on a local Xserver, or
cross compile package for the arm architecture used on the n800 tablet.
There are no sword library nor swig available by default on this
machine, but i manage to package both.
Now, reading your mails and looking at what the different Makefile were
doing, i manage to perform the following:
swig -python -c++ -shadow -o python/Sword.cxx -I. -I/usr/include/sword sword.i
echo "writing python/setup.py"
echo "#! /usr/bin/python" > python/setup.py
echo "" >> python/setup.py
echo "from distutils.core import setup, Extension" >> python/setup.py
echo "setup (name = \"sword\"," >> python/setup.py
echo " version = \"1.5.9\"," >> python/setup.py
echo " maintainer = \"Sword Developers\"," >> python/setup.py
echo " maintainer_email = \"sword-devel at crosswire.org\"," >> python/setup.py
echo " url = \"http://www.crosswire.org/sword\"," >> python/setup.py
echo " py_modules = [\"Sword\"]," >> python/setup.py
echo " include_dirs=['/usr/include/sword']," >> python/setup.py
echo " ext_modules = [Extension(\"_Sword\", [\"Sword.cxx\"]," >> python/setup.py
echo " libraries=[('sword')], " >> python/setup.py
echo " define_macros=[('SWIG',1)])], " >> python/setup.py
echo ")" >> python/setup.py
python setup.py build_ext -I. -I/usr/include/sword -L/usr/lib/sword
I end up with some _Sword.o (./build/lib.linux-i686-2.3/_Sword.so) i
place in the chrooted environment here
However, i still cannot load the Sword module:
[sbox-SDK_X86: ~/dev/maemosword/sword-1.5.9/bindings/swig/python] >
Python 2.3.4 (#1, Nov 30 2006, 05:03:15)
[GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Sword
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "Sword.py", line 7, in ?
ImportError: /scratchbox/host_shared/lib/libc.so.6: version
`GLIBC_2.3.4' not found (required by /usr/lib/libsword-1.5.9.so)
Why is sword looking for GLIBC_2.3.4 ?
Sword binary such as diatheke works ok.
ldd /usr/bin/diatheke shows the following libc line
libc.so.6 => /lib/libc.so.6 (0xb7b03000)
ldd /usr/lib/libsword-1.5.9.so shows:
libc.so.6 => /lib/libc.so.6 (0x00000000)
The glibc is packaged already in the sdk and is not 2.3.4 but 2.3.5 :
ii libc6 2.3.5cs2005q3.2-5.osso12 GNU C Library: Shared libraries and Timezone data
I do not understant why python states libsword need GLIBC_2.3.4 although
other binary linked against it do not complain.
I must admit i m not that used of playing with linkers :)
I m not sure if the problem is located in the way i packaged/compile
sword or the way i generate the swig binding.
Any help would be appreciated.
Have a nice day.
More information about the sword-devel