Saturday, February 5, 2011

Building ssl for Python 2.5.4 on Windows

I went through the instructions from this blog post:

In the end while building ssl, I faced a one last problem:



C:\MinGW\bin\gcc.exe -mno-cygwin -shared -s build\temp.win32-2.5\Release\ssl\_ssl2.o build\temp.win32-2.5\Release\ssl\_ssl2.def "-LC:\Program Files (x86)\GnuWin32\lib" -LC:\Python25\libs -LC:\Python25\PCBuild -lssl -lcrypto -lwsock32 -lgdi32 -lgw32c -lole32 -luuid -lpython25 -lmsvcr71 -o build\lib.win32-2.5\ssl\_ssl2.pyd -static
build\temp.win32-2.5\Release\ssl\_ssl2.o:_ssl2.c:(.text+0x1724): undefined reference to `_wassert'
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1


As you can notice, the linker is complaining about _wassert.

After some googling, I ended up opening the ssl\_ssl.c file in the ssl source package and added the following lines at the beginning (after Python.h include).



#ifdef __MINGW32__
#undef assert
#define assert(expr) ((void)0)
#endif


The build went smoothly after that.