[PYTHON-CRYPTO] MCrypto2 build problems for 0.15 tag

Conrad Steenberg conrad at HEP.CALTECH.EDU
Wed Oct 26 17:16:20 CEST 2005

Hi Ian

On Wed, 2005-10-26 at 12:59 +0100, Ian Stokes-Rees wrote:
> Hi Conrad,
> Conrad Steenberg wrote:
> > OpenSSL have been going through a "const"-ifying exercise lately that
> > m2crypto keeps getting bitten by.
> > 
> > If you look in there's a .src.rpm with
> > patches to make m2crypto compile against openssl-0.9.7g, swig-1.3.24,
> > and python-2.4.2.
> Thanks for this.  I still end up with 3 pesky errors.  I'm not using 
> OpenPKG, so I have to manually apply the patches 
> (m2crypto-0.11.getkey.diff, patch.makefile3, openssl-0.9.8a.diff) and 
> fix the Makefile.  The errors are:
> _m2crypto_wrap.c:5129: conflicting types for `c2i_ASN1_OBJECT'
> openssl/asn1.h:704: previous declaration of  `c2i_ASN1_OBJECT'
> _m2crypto_wrap.c:5130: conflicting types for `d2i_ASN1_OBJECT'
> openssl/asn1.h:706: previous declaration of  `d2i_ASN1_OBJECT'
> _m2crypto_wrap.c:5140: conflicting types for `ASN1_UTCTIME_set_string'
> openssl/asn1.h:759: previous declaration of  `ASN1_UTCTIME_set_string'

My patch was for SWIG-1.3.24, so it seems like there was another
const-related change in .25 :-(

> and one SWIG error (repeated many many times):
> Warning(121): %name is deprecated.  Use %rename instead.

The m2c code should be updated to use the %rename directive, but for now
the above is just a warning. Annoying, but it still works.

> If I comment out the problematic declarations in _m2crypto_wrap.c the 
> errors turn into warnings:

The best place to fix this is in SWIG/_asn1.i and make a patch that you
can apply.

> _m2crypto_wrap.c:16371: warning: passing arg 2 of `c2i_ASN1_OBJECT' from 
> incompatible pointer type
> _m2crypto_wrap.c:16399: warning: passing arg 2 of `d2i_ASN1_OBJECT' from 
> incompatible pointer type
> _m2crypto_wrap.c:16642: warning: passing arg 2 of 
> `ASN1_UTCTIME_set_string' discards qualifiers from pointer target type
> But those sound dangerous.  What am I doing wrong?

Nothing. The patches simply needed to be updated slightly.

These are all related to const qualifiers added to the openssl headers,
but not to the .i files. Look for the definitions of the above objects
in SWIG/_asn1.i and add/remove the const qualifiers to match the openssl

Btw, this seems to expose a serious flaw in the SWIG methodology, imho:
having to copy large portions of library header files that needed to be
wrapped. The Pyrex tool has the same problem.

OK, I'll shut up now ;-)



> TIA, Ian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2531 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-crypto/attachments/20051026/df2f58a5/attachment.bin>

More information about the python-crypto mailing list