I am trying to build M2Crypto 0.21.1 with OpenSSL 1.0.0c (or 0.9.7m) for Python 2.5.4 on windows, but SWIG is conspiring against me. I've tried both SWIG 2.0.1 and SWIG 1.3.40 and I get the same error:
swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
C:\Development\swigwin-1.3.40\swig.exe -python -IC:\Development\Python-2.5.4\include -IC:\Development\Python-2.5.4\PC -Ic:\Development\openssl-0.9.7m\include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
c:\Development\openssl-0.9.7m\include\openssl\opensslv.h(1): Error: Syntax error in input(1).
All permutations of OpenSSL/SWIG show this error. I've tried invoking swig by hand and passing all the "extra verbose" options I could, but none of them are even close to informative. What else can I do to try to find the true source of this problem?
(There are suggestions on this开发者_StackOverflow site to edit the .i file for M2Crypto, but 0.21.1 already has the suggested changes integrated)
Actually the problem here isn't SWIG, but I'll leave this question/answer for the next M2Crypto user that comes along - maybe it will help them.
The problem is that the M2Crypto setup.py by default points to <your openssl dir>/include
, but if that openssl directory is the source tree, include/
isn't the right place to look (on windows at least) - you need to be looking in inc32/
, otherwise opensslv.h
is just a line pointing to a different file, which is why SWIG bombs out on line 1.
精彩评论