When attempting to build pyOpenSSL on Windows 7 for a 64-bit Python, I ran into 
the compilation errors shown below.

c:\VS9\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG 
-IK:\Toolchains\Windows7\X64\sig1\Python-2.6.6\include 
-IK:\Toolchains\Windows7\X64\sig1\Python-2.6.6\PC - 
IK:\Toolchains\Windows7\X64\sig1\openssl-1.0.0d\include /Tcsrc/crypto/crypto.c 
/Fobuild\temp.win-amd64-2.6\Release\src/crypto/crypto.obj crypto.c

c:\dev\pyopenssl-0.10\src\crypto\x509name.h(27) : error C2059: syntax error : 
'('
c:\dev\pyopenssl-0.10\src\crypto\x509name.h(30) : error C2059: syntax error : 
'}'
K:\Toolchains\Windows7\X64\sig1\openssl-1.0.0d\include\openssl/x509v3.h(192) : 
error C2059: syntax error : '('
K:\Toolchains\Windows7\X64\sig1\openssl-1.0.0d\include\openssl/x509v3.h(200) : 
error C2059: syntax error : 'type'
K:\Toolchains\Windows7\X64\sig1\openssl-1.0.0d\include\openssl/x509v3.h(204) : 
error C2059: syntax error : '}'
K:\Toolchains\Windows7\X64\sig1\openssl-1.0.0d\include\openssl/x509v3.h(205) : 
error C2059: syntax error : '}'

{ more errors follow ...}

I saw several threads on this in the mailing this and realize this is from a 
macro defined in a Windows header file.  I also noticed that the OpenSSL header 
files try to avoid this problem by using "#undef X509_NAME" lines.  However, in 
this case, the macro was still defined after the "ssl.h" file was included.  I 
even tried manually defining the Windows macros on the compilation line and 
still had this issue.  The source code that has the problem is:

#ifndef PyOpenSSL_crypto_X509NAME_H_
#define PyOpenSSL_crypto_X509NAME_H_

#include <Python.h>
#include <openssl/ssl.h>

extern  int     init_crypto_x509name       (PyObject *);

extern  PyTypeObject      crypto_X509Name_Type;

#define crypto_X509Name_Check(v) ((v)->ob_type == &crypto_X509Name_Type)

typedef struct {
                        PyObject_HEAD
                        X509_NAME           *x509_name;
                        int                  dealloc;
                        PyObject            *parent_cert;
} crypto_X509NameObj;


#endif

In order to get pyOpenSSL built, I had to specifically add a "#undef X509_NAME" 
line after the "#include <openssl/ssl.h>" line.  It's possible that the Windows 
headers have been rearranged in such a way that wasn't taken into consideration 
by the OpenSSL code.

            Kris


________________________________
IMPORTANT: The information contained in this email and/or its attachments is 
confidential. If you are not the intended recipient, please notify the sender 
immediately by reply and immediately delete this message and all its 
attachments. Any review, use, reproduction, disclosure or dissemination of this 
message or any attachment by an unintended recipient is strictly prohibited. 
Neither this message nor any attachment is intended as or should be construed 
as an offer, solicitation or recommendation to buy or sell any security or 
other financial instrument. Neither the sender, his or her employer nor any of 
their respective affiliates makes any warranties as to the completeness or 
accuracy of any of the information contained herein or that this message or any 
of its attachments is free of viruses.

Reply via email to