Re: M2Crypto build error - _lib.h:5: error: redefinition of typedef 'Py_ssize_t'
Philip Kershaw <[email protected]>
| Newsgroups | gmane.comp.python.cryptography |
|---|---|
| Organization | RAL |
| Message-ID | <[email protected]> |
Hi Heikki, See below... On Monday 15 October 2007 19:01, Heikki Toivonen wrote: > Philip Kershaw wrote: > > 0.18.2 still breaks for me unfortunately but I can build by commenting > > out: > > > > /* > > #if PY_VERSION_HEX < 0x02050000 > > typedef int Py_ssize_t; > > #endif > > */ > > You don't have 0.18.2, because 0.18.2 has this: > > #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) > typedef int Py_ssize_t; > #define PY_SSIZE_T_MAX INT_MAX > #define PY_SSIZE_T_MIN INT_MIN > #endif I quoted the wrong piece of code. The build _does_ still fail with 0.18.2 and the code as you've included above. However I think the problem lies elsewhere. I noticed in _m2crypto_wrap.c: /* Py_ssize_t for old Pythons */ #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #endif It doesn't follow the formula in PEP 353 that you've used for _lib.h. If I edit the code and change it to: #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #endif I can compile it: # gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/ssl/include -I/usr/local/include/python2.4 -I/usr/local/ssl/include -I/root/ndg-downloads/m2crypto-0.18.2/SWIG -c SWIG/_m2crypto_wrap.c -o build/temp.linux-i686-2.4/SWIG/_m2crypto_wrap.o -DTHREADING but I have to miss out the swig step as it overwrites _m2crypto_wrap.c. Given this I'm guessing it's a bug in swig's generation of the wrap file. Cheers, Phil