[Xapian-discuss] Building Xapian and Python Bindings for Windows: Solved

Olly Betts olly at survex.com
Fri Jan 6 01:06:25 GMT 2006


On Thu, Jan 05, 2006 at 08:44:28PM +0100, Patrick M?zard wrote:
> Olly Betts a écrit :
> 
> >> [problems with libbackend.la]
> >
> >I suspect that this is a consequence of the "wrong find.exe" problem.
> >I'm just putting together a mail to send to the libtool list.
>
> Well, maybe but I get it too when paths are set correctly.

You're right - I've since borrowed a windows box with cygwin on to
investigate, and I'm seeing this too.  It's not a fast box though, and
cygwin seems to make it even slower so it's taking a while to get
anywhere.  But I've reduced the problem to:

cd backends
make libbackend.la

which does plausible looking things, but libbackend.la isn't actually
created!  I have similar issues in each of the backend subdirectories
too.  I can get around this by touching all the objects/sublibrary .la
files before running make to build each library.  Very odd...

> Actually, the path is correct in a cygwin environment. I was suspecting 
> the cygwin shell might be unable to start the python interpreter for 
> some reason but it seems I was wrong. I can start it with this command. 
> The exact error is :
> 
> """
> PYTHONPATH=".;.libs" /cygdrive/d/Python23//python -c "import xapian"
> /bin/sh: /cygdrive/d/Python23//python: No such file or directory
> """
> 
> If I replace "/cygdrive/d/Python23//python" with "python" the call works 
> better but ultimately fails because the cygwin support DLL is not in 
> python sys.path and thus cannot be imported by "_xapian.dll".

So is the "No such file or directory" an error from the python
interpreter failing to find some other file?

> "libxapian.la" is the only place where the cygwin runtime DLL is 
> mentionned, something is definitely broken with .la. If I copy the 
> support DLL with _xapian.dll, the make run terminates successfully.

On Unix, libtool would note in _xapian.so which depending libraries are
needed and their paths if non-standard.  But I don't think DLLs can
store such paths.  Python doesn't look at .la files, so the reference
there won't help us here.

We need to have the directory with the cygwin DLL in on some path or
other.  Maybe python's sys.path, or PYTHONPATH perhaps?

> Also, there is a trap here : the .pyc is generated before the "import 
> xapian" statement is actually run. Therefore, even if the import action 
> fails, the ".pyc" exists and the action will be skipped on next make 
> run. Something like "import _xapian; import xapian" could be more 
> appropriate.

OK.  I've just tried on Unix, and this seems to work there too.  So I
guess we should always do this.

Cheers,
    Olly



More information about the Xapian-discuss mailing list