I am trying to compile Python bindings for OpenSSL (pyOpenSSL) on Windows Vista x64 using Visual Studio 2008. When I run python setup.py build_ext -IC:\OpenSSL\include , it dies with the following error:
building 'OpenSSL.crypto' extension C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I\OpenSSL\include -IC:\Python26\include -IC:\Python26\PC /Tcsrc/crypto/x509name.c /Fobuild\temp.win-amd64-2.6\Release\src/crypto/x509name.obj x509name.c src/crypto/x509name.c(16) : error C2133: 'crypto_X509Name_methods' : unknown size error: command '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe"' failed with exit status 2
When I look at the source in question, I see the following on line 16:
static PyMethodDef crypto_X509Name_methods[];
My C is very rusty, so I donโt remember whether you can do it or not. Since this is a Python library, I would suggest that it was written for compilation in gcc, but I do not have the Cygwin environment installed on this computer. Is there any switch that I can use to compile this code with VS2008?
Answer:
The following is in the code:
#define ADD_METHOD(name) \ { #name, (PyCFunction)crypto_X509Name_##name, METH_VARARGS, crypto_X509Name_##name##_doc } static PyMethodDef crypto_X509Name_methods[] = { ADD_METHOD(hash), ADD_METHOD(der), ADD_METHOD(get_components), { NULL, NULL } }; #undef ADD_METHOD
Rejecting Neil Butterworth's suggestion, I changed the line by mistake:
static PyMethodDef crypto_X509Name_methods[];
in
static PyMethodDef crypto_X509Name_methods[4];
and compiled code.
Thanks to everyone.
source share