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]>
Thanks for the help.   

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
*/

My OpenSSL version is 0.9.8f.   The system is 32-bit I think:

# uname -a
Linux ndg 2.6.9-42.0.2.ELsmp #1 SMP Thu Aug 17 18:00:32 EDT 2006 i686 i686 
i386 GNU/Linux

I've copied in the easy_install output again below...

Cheers,
Phil

# easy_install M2Crypto
Searching for M2Crypto
Reading http://pypi.python.org/simple/M2Crypto/
Reading http://chandlerproject.org/Projects/MeTooCrypto
Reading http://wiki.osafoundation.org/bin/view/Projects/MeTooCrypto
Reading http://www.post1.com/home/ngps/m2
Reading http://sandbox.rulemaker.net/ngps/m2/
Best match: m2crypto 0.18.2
Downloading 
http://chandlerproject.org/pub/Projects/MeTooCrypto/m2crypto-0.18.2.tar.gz
Processing m2crypto-0.18.2.tar.gz
Running m2crypto-0.18.2/setup.py -q 
bdist_egg --dist-dir /tmp/easy_install-Ow4Qhc/m2crypto-0.18.2/egg-dist-tmp-tCKRoa
SWIG/_bio.i:62: Warning(454): Setting a pointer/reference variable may leak 
memory.
SWIG/_rand.i:19: Warning(454): Setting a pointer/reference variable may leak 
memory.
SWIG/_evp.i:148: Warning(454): Setting a pointer/reference variable may leak 
memory.
SWIG/_dh.i:35: Warning(454): Setting a pointer/reference variable may leak 
memory.
SWIG/_rsa.i:43: Warning(454): Setting a pointer/reference variable may leak 
memory.
SWIG/_dsa.i:31: Warning(454): Setting a pointer/reference variable may leak 
memory.
SWIG/_ssl.i:201: Warning(454): Setting a pointer/reference variable may leak 
memory.
SWIG/_x509.i:302: Warning(454): Setting a pointer/reference variable may leak 
memory.
SWIG/_pkcs7.i:40: Warning(454): Setting a pointer/reference variable may leak 
memory.
SWIG/_pkcs7.i:40: Warning(454): Setting a pointer/reference variable may leak 
memory.
SWIG/_util.i:9: Warning(454): Setting a pointer/reference variable may leak 
memory.
SWIG/_ec.i:111: Warning(454): Setting a pointer/reference variable may leak 
memory.
In file included from SWIG/_m2crypto_wrap.c:2528:
/tmp/easy_install-Ow4Qhc/m2crypto-0.18.2/SWIG/_lib.h:5: error: redefinition of 
typedef 'Py_ssize_t'
SWIG/_m2crypto_wrap.c:782: error: previous declaration of 'Py_ssize_t' was 
here
SWIG/_m2crypto_wrap.c:5724: warning: function declaration isn't a prototype
SWIG/_m2crypto_wrap.c: In function `make_stack_from_der_sequence':
SWIG/_m2crypto_wrap.c:5828: warning: function declaration isn't a prototype
error: Setup script exited with error: command 'gcc' failed with exit status 1

On Friday 12 October 2007 18:21, Pavel Shramov wrote:
> On Fri, Oct 12, 2007 at 03:18:51PM +0100, Philip Kershaw wrote:
> > Hello,
> >
> > I'm getting a strange error installing M2Crypto on Redhat:
> >
> > In file included from SWIG/_m2crypto_wrap.c:2528:
> > /tmp/easy_install-F8-kVi/m2crypto-0.18.1/SWIG/_lib.h:5: error:
> > redefinition of typedef 'Py_ssize_t'
> >
> > Has anyone seen anything similar?
>
> I have same error on debian/unstable with
>
> $ gcc --version
> gcc (GCC) 4.1.3 20070518 (prerelease) (Debian 4.1.2-8)
>
> $ swig -version
>
> SWIG Version 1.3.31
>
> $ python
> Python 2.4.4 (#2, Apr 26 2007, 00:02:45)
> [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
>
> (Python 2.5.1 (r251:54863, Aug 17 2007, 00:51:07) is also installed)
>
> As I remember this error appears when I'd upgraded python (or SWIG?
> don't remember, it was somewhat in the middle of summer).
> I commented out block with Py_ssize_t definition in local version.
> Patch is attached. Maybe better solution will be something like
>
> #if !defined(Py_ssize_t)
> typedef....
> #endif
>
> 		Pavel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.