[Xapian-discuss] ucs2 build of xapian?

Jason Witherspoon jwitherspoon at rainbow.coop
Wed Dec 19 23:04:08 GMT 2007


Hey Olly--
 
First off, thanks so much for trying to walk me through this stuff.
 
So I have no /usr/include/python2.5/pyconfig.h file.  It seems to be in /usr/local/include/python2.5/pyconfig.h for whatever reason, & it's "#define Py_UNICODE_SIZE 2"
 
However, there is a /usr/include/python2.4/pyconfig.h (not /usr/local/..., NB) file, which returns "#define Py_UNICODE_SIZE 4"
 
The active Python is definitely 2.5.1, but maybe Xapian is pulling the old 2.4 pyconfig file...?  Seems unlikely as I just renamed the /usr/include/python2.4 directory & I'm still getting the exact errormessage from below....  And the /usr/local/include/python2.4/pyconfig.h file also comes back size 2, so I don't know where else _xapian.so would be getting that from....  If I'm even clear on what's going on in this flow, which is doubtful ;-)
 
Thanks again!

________________________________

From: Olly Betts [mailto:olly at survex.com]
Sent: Tue 12/18/2007 8:11 PM
To: Jason Witherspoon
Cc: Xapian Discussion
Subject: Re: [Xapian-discuss] ucs2 build of xapian?



On Thu, Dec 13, 2007 at 01:56:02PM -0800, Jason Witherspoon wrote:
> Recompiling everything from scratch now, on top of ucs2-Python, I get
> the same problem:
>
> Traceback (most recent call last):
>    File "xap_indexer.py", line 4, in <module>
>      import xapian
>    File "/usr/lib/python2.5/site-packages/xapian.py", line 6, in
> <module>
>      import _xapian
> ImportError: /usr/lib/python2.5/site-packages/_xapian.so: undefined
> symbol: PyUnicodeUCS4_EncodeUTF8

OK, so what we need to do is work out why this is failing like this.

The Python bindings code just calls PyUnicode_EncodeUTF8.  Looking at
the python headers:

/usr/include/python2.5/unicodeobject.h

has:

    #ifndef Py_UNICODE_WIDE
    [...]
    # define PyUnicode_EncodeUTF8 PyUnicodeUCS2_EncodeUTF8
    [...]
    #else
    [...]
    # define PyUnicode_EncodeUTF8 PyUnicodeUCS4_EncodeUTF8
    [...]
    #endif
   
And apart from a later prototype, that's the only mention of
PyUnicode_EncodeUTF8 in the python headers.

The only place in the headers where Py_UNICODE_WIDE is defined is
earlier in the same header:

    #if Py_UNICODE_SIZE >= 4
    #define Py_UNICODE_WIDE
    #endif

So what does this command report for you?

    grep Py_UNICODE_SIZE /usr/include/python2.5/pyconfig.h

Cheers,
    Olly




More information about the Xapian-discuss mailing list