I have a C file that I need compiled on Windows7. I have installed MinGW for gcc. I also need OpenSSL, so followed the links from their site and downloaded the full developer package from Shining Light Productions (along with the 64-bit Redistro package from MS).
When I try to compile my file using this command:
gcc -D_WIN32 -O2 -shared -Wl,--kill-at -lcrypto -I%JAVA_HOME%\include -I%JAVA_HOME%\include\win32 -IC:\OpenSSL-Win64\include -LC:\OpenSSL-Win64\lib -lm -std=c99 osaccess.c -o libosaccess.dll
I get the error:
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lcrypto
collect2.exe: error: ld returned 1 exit status
What I find particularly peculiar, is the unix-style forward slashes used in the error. Also, the path is correct, but the case is not. The valid path is C:\MinGW\bin...
I also cannot find any crypto library (either libcrypto.* or crypt*lib.*) anywhere, so I guess this is why it cannot find -lcrypto
. I would've thought that this would've come with the full install. Has anyone else encountered this before, or know of why it may be happening?
The correct library name for the Shining Light distribution is
libeay32
(found atlib/libeay32.lib
). This library corresponds tolibcrypto
.