[PYTHON-CRYPTO] M2Crypto build error - _lib.h:5: error: redefinition of typedef 'Py_ssize_t'

Pavel Shramov shramov at MEXMAT.NET
Fri Oct 12 19:21:58 CEST 2007


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
-------------- next part --------------
commit 96ba76af3dc40c071ff6fef7109c381ba19babe4
Author: Pavel Shramov <psha at qwe.ipib.msu.ru>
Date:   Fri Oct 12 20:52:45 2007 +0400

    fixe compile error with some versions of SWIG (?)

diff --git a/SWIG/_lib.h b/SWIG/_lib.h
index c0760d4..c131e4a 100644
--- a/SWIG/_lib.h
+++ b/SWIG/_lib.h
@@ -1,9 +1,11 @@
 /* Copyright (c) 1999 Ng Pheng Siong. All rights reserved. */
 /* $Id$ */
 
+/*
 #if PY_VERSION_HEX < 0x02050000
 typedef int Py_ssize_t;
 #endif
+*/
 
 typedef struct _blob {
 	unsigned char *data;


More information about the python-crypto mailing list