M2Crypto 0.18 - new version, same old build bugs - more details

John Nagle nagle at animats.com
Tue Sep 25 13:40:50 EDT 2007


Heikki Toivonen wrote:
> John Nagle wrote:
> 
>>But notice that the -D entry didn't appear on the SWIG command line.
>>Neither did the "-includeall".  The "swig_opts" values around line
>>129 aren't actually being used.  I think that's left over from the code
>>intended
>>to allow builds with Python 2.3 and earlier.  The "self.swig_opts" up at
>>line 53 of "setup.py" seems to be controlling.  The patch was to
>>the obsolete code.
> 
> 
> Aha! Good find. I reopened
> https://bugzilla.osafoundation.org/show_bug.cgi?id=9404 and attached a
> patch that should address this for real this time. At least -includeall
> appears in my Ubuntu Dapper Drake environment. Could you give it a go
> and let me know how it works?

    That's progress, but the build still doesn't work:

$ python setup.py build
running build
running build_py
running build_ext
building 'M2Crypto.__m2crypto' extension
swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
swig -python -I/usr/local/include/python2.5 -I/usr/include -includeall 
-D__i386__ -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
/usr/include/openssl/opensslconf.h:13: Error: Unable to find 'opensslconf-i386.h'
error: command 'swig' failed with exit status 1

Now that SWIG is being invoked with "-includeall", it has to have
all the include paths defined.  (Without "includeall", includes
are deferred until the C compile stage.) Note that the SWIG command line
specifies "/usr/include", but not "/usr/include/openssl".
Within M2Crypto's SWIG files, there's

    _ec.i:%include <openssl/opensslconf.h>

which brings in "opensslconf.h" from /usr/include/openssl.
But that file has

#if defined(__i386__)
#include "opensslconf-i386.h"
#elif defined(__ia64__)
...

Since "opensslconf-i386.h" lives in /usr/include/openssl,
and that directory isn't mentioned on the SWIG command line,
the #include of "opensslconf-i386.h" fails.

And, no, adding

	self.swig_opts.append('-DOPENSSL_NO_EC')
	# Uncomment if you can't build with EC disabled

does not help.

As a test, I tried adding "-I/usr/include/openssl" to the SWIG command
line.  Building then gets further, but during a C compile, we get

SWIG/_m2crypto_wrap.c:2529:18: error: _lib.h: No such file or directory

and the build goes downhill from there, with many compile errors in the
GCC phase.  The gcc call

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes 
-fPIC -I/usr/local/include/python2.5 -c SWIG/_m2crypto_wrap.c -o 
build/temp.linux-i686-2.5/SWIG/_m2crypto_wrap.o -DTHREADING

is in the directory below SWIG, and doesn't include SWIG, so it's clear
why gcc couldn't find the file.

So those fixes were not enough.  Include file management in the M2Crypto build
clearly needs some work.

				John Nagle



More information about the Python-list mailing list