[Xapian-discuss] problem compiling static python bindings

Noah Hoffman nghoffma at gmail.com
Thu Feb 7 03:59:35 GMT 2008


Hi Olly, thanks for the response -

> > However, I believe that I need to compile the python bindings
> > statically, because attempts to import xapian from the cgi script (I'm
> > using MoinMoin - moin.cgi, for what it's worth) result in an error:
>
> We don't support building xapian-bindings with a static xapian-core.
> For more information see:
>
> http://xapian.org/cgi-bin/bugzilla/show_bug.cgi?id=187
>

Okay, that's a good explanation of the issues involved.

> You shouldn't need to set LD_LIBRARY_PATH - the rpath should do the
> trick, and has for me in the past on Linux.  It would be interesting
> to work out why this doesn't seem to work.
>

It may have something to do with the complex filesystem (the details
of which I am almost completely ignorant) in this shared server
environment. For example, I can execute a cgi script containing the
following python code from the command line with the following
results:

print '-->',os.path.abspath('.')
print '-->', commands.getoutput('pwd')
pth = '/rc21/d75/labmed1/public_html/local/lib'
print '--> access', pth, os.access(pth, os.F_OK)
print '-->', commands.getoutput('ls %s/libxapian.so' % pth)

abspath --> /nfs/aesop01/hw11/d99/labmed1/admin
pwd --> /rc21/d75/labmed1/public_html/admin
access --> /rc21/d75/labmed1/public_html/local/lib True
ls --> /rc21/d75/labmed1/public_html/local/lib/libxapian.so

... but I get this when run as cgi script:

abspath --> /nfs/aesop01/hw11/d99/labmed1/admin
pwd --> /nfs/aesop01/hw11/d99/labmed1/admin
access --> /rc21/d75/labmed1/public_html/local/lib False
ls --> ls: /rc21/d75/labmed1/public_html/local/lib/libxapian.so: No
such file or directory

However, a relative path does work in the cgi script:

pth = '../local/lib'

access --> ../local/lib True
ls --> ../local/lib/libxapian.so

So all of this leads me to ask if I can refer to the shared libraries
with a relative path (and if this is possible and you are so inclined,
I fear I will need fairly explicit instructions because I am not too
familiar with the details of gcc).

> But if you do set it, you may need to set it before invoking the python
> script using a shell script wrapper.
>
> For example:
>
>     #!/bin/sh
>     LD_LIBRARY_PATH=/rc21/d75/labmed1/public_html/local/lib
>     export LD_LIBRARY_PATH
>     exec python /path/to/script.py
>

My examples above leads me to believe that this won't work in the cgi
environment; but in any case any thoughts on how I might set
environment variables of a cgi script to accomplish this? I looked
into using a directive an .htaccess file, but that feature seems to be
disabled at the system level.

> Cheers,
>     Olly
>

Thanks a lot for your help,
Noah



More information about the Xapian-discuss mailing list