1. install cygwin on my PC. To avoid too much trying and failing, I have installed the full cygwin. Storage space is cheap but time is very expensive.
2. install mingw
3. download openssl from openssl.org. I used 0.9.8k
4. untar/unzip 0.9.8k package to cygwin how directory
5. start Cygwin xterm (ya, Cygwin not msys)
6. in the xterm, go to openssl-0.9.8k directory that you just unpacked
7. ./Configure mingw
8. make
The steps above create static library that can be used with mingw. To create the dll, you need to do:
$ echo EXPORTS > libcrypto.def
$ nm libcrypto.a | grep ' T _' | sed 's,^.* T _,,' >> libcrypto.def
$ dllwrap -o libcrypto.dll --def libcrypto.def libcrypto.a -lws2_32 -lgdi32
$ echo EXPORTS > libssl.def
$ nm libssl.a | grep 'T _' | sed 's,^.* T _,,' >> libssl.def
$ dllwrap -o libssl.dll --def libssl.def libssl.a libcrypto.dll
After this, you can copy the *.a to /mingw/lib and *.dll to /ming/bin
This process didn't seem to work for me. Cygwin does manage to build everything successfully, but taking the resultant .a files it produces and attempting to compile them into QT in mingw produces a lot of errors like:
ReplyDeleteundefined reference _imp____ctype_ptr__
These errors don't come out when I use the precompiled openssl distributed by slproweb.
Tanks a lot!
ReplyDeleteI didn't know how to get crypto and ssl as dynamic linked librarys. This worked for me with openssl-1.0.2d and mingw