Hmm ... I've changed my mind about using distutils to build
htsearch. It looks like GNU Automake does actually handle Python apps, which means I won't have to mess around getting all the compiler quirk stuff that comes out of Automake working with
distutils. Yay! Now to try and get my Debian install to use the right version of Automake, so it doesn't barf on the
- To get Python support, put
configure.in. Then run
aclocalto get the Python stuff included in the local library cache (
aclocal.m4). If you don't run
aclocal, you'll get an error about AM_PATH_PYTHON not being found.
- It looks like you need Automake 1.7 to get the Python support ... the Debian package for 1.6 doesn't seem to include the
py-compilescript. (Gives the error
configure.in:186: required file `./py-compile' not found).
apt-get install autoconf automake1.7will get you the right versions.
- To test changes to
./configure --prefix=$HOME/htdig/cvs/inst --with-python=yes
- Automake seems to get confused if you set
prefixbut have Python installed under another prefix (it defines
PYTHON_PREFIX = $(prefix)). I'm testing ht://Dig in
/home/phil/htdig/cvs/instand the resulting
Python.hto be in
/home/phil/htdig/cvs/inst/include/python2.2. The workaround is to just use
--prefix=/usr, and to install the ht://Dig module in your standard Python site-packages directory later on, I guess.
- Automake won't let you make Makefiles that both let you build something as a library with
libtooland let you build it as a normal binary (without
libtool). So it looks like I can't make this coexist with the normal ht://Dig distribution ... damn. I was hoping to be able to get this included in the official version of ht://Dig, but that's looking much less likely now, unless I can convince them to build most of
htsearchas a shared library, and only make little binaries for
qtestthat link to that. That might be OK ...
g++to generate shared libraries. This will screw up your program if you need to link to the C++ standard library:
Python 2.2.1 (#1, Jul 29 2002, 23:15:49)
[GCC 2.95.4 20011002 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import _htsearch
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: /home/phil/htdig/cvs/htdig/htlib/.libs/libht-3.2.0.so: undefined symbol: endl__FR7ostream
Hmm - looks like libtool officially doesn't like C++. Damn. I wonder if I can
export LD=g++or something.
At least the
libtoolmanual is a funny read.
If I take the last thing that
libtoolruns and change the
cp .libs/libhtsearch.so.0.0.0 _htsearch.soand
python2.2(as above), it works. Now to automate this.
Aha - this may be the solution. Hmm. No, that didn't work.
Here's another crack at it: don't let
libtoolat it at all, but compile as a program (called
_htsearch.sowith the link flag
-shared. That's it! It worked!
So there you go. If you want to get something compiling as a Python module under Automake:
- Put your library file (
_htsearch.so) in your
_htsearch_so_LDFLAGS = -shared
- Cross fingers,
./configure, and build ...