2015-05-04 112 views
2

当我尝试在没有SSL支持的情况下编译cUrl时,没有任何问题。我用的命令是这样的:在Windows上使用OpenSSL编译cUrl,缺少-lcrypto和-lssl

mingw32-make mingw32 

我跟着cUrl作者说明安装文件,以使其支持SSL,试图编译这样说:

mingw32-make mingw32-ssl-zlib OPENSSL_PATH=D:/Programy/MinGW/OpenSSL ZLIB_PATH=D:/Programy/MinGW/zlib 

但正如我得到这个不工作错误:

D:\Programy\MinGW\cUrl>mingw32-make mingw32-ssl-zlib OPENSSL_PATH=D:/Programy/Mi 
nGW/OpenSSL ZLIB_PATH=D:/Programy/MinGW/zlib 
mingw32-make -C lib -f Makefile.m32 CFG=mingw32-ssl-zlib 
mingw32-make[1]: Entering directory 'D:/Programy/MinGW/cUrl/lib' 
gcc -s -shared -o libcurl.dll \ 
    -Wl,--output-def,libcurl.def,--out-implib,libcurldll.a \ 
    file.o timeval.o base64.o hostip.o progress.o formdata.o cookie.o http.o sendf 
.o ftp.o url.o dict.o if2ip.o speedcheck.o ldap.o version.o getenv.o escape.o mp 
rintf.o telnet.o netrc.o getinfo.o transfer.o strequal.o easy.o security.o curl_ 
fnmatch.o fileinfo.o ftplistparser.o wildcard.o krb5.o memdebug.o http_chunks.o 
strtok.o connect.o llist.o hash.o multi.o content_encoding.o share.o http_digest 
.o md4.o md5.o http_negotiate.o inet_pton.o strtoofft.o strerror.o amigaos.o hos 
tasyn.o hostip4.o hostip6.o hostsyn.o inet_ntop.o parsedate.o select.o tftp.o sp 
lay.o strdup.o socks.o ssh.o rawstr.o curl_addrinfo.o socks_gssapi.o socks_sspi. 
o curl_sspi.o slist.o nonblock.o curl_memrchr.o imap.o pop3.o smtp.o pingpong.o 
rtsp.o curl_threads.o warnless.o hmac.o curl_rtmp.o openldap.o curl_gethostname. 
o gopher.o idn_win32.o http_negotiate_sspi.o http_proxy.o non-ascii.o asyn-ares. 
o asyn-thread.o curl_gssapi.o curl_ntlm.o curl_ntlm_wb.o curl_ntlm_core.o curl_n 
tlm_msgs.o curl_sasl.o curl_multibyte.o hostcheck.o bundles.o conncache.o pipeli 
ne.o dotdot.o x509asn1.o http2.o curl_sasl_sspi.o smb.o curl_sasl_gssapi.o curl_ 
endian.o curl_des.o vtls/openssl.o vtls/gtls.o vtls/vtls.o vtls/nss.o vtls/polar 
ssl.o vtls/polarssl_threadlock.o vtls/axtls.o vtls/cyassl.o vtls/schannel.o vtls 
/darwinssl.o vtls/gskit.o libcurl.res -L"D:/Programy/MinGW/OpenSSL/lib" -lcrypto 
-lssl -L"D:/Programy/MinGW/zlib" -lz -lwldap32 -lws2_32 
D:/Programy/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x8 
6_64-w64-mingw32/bin/ld.exe: cannot find -lcrypto 
D:/Programy/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x8 
6_64-w64-mingw32/bin/ld.exe: cannot find -lssl 
collect2.exe: error: ld returned 1 exit status 
Makefile.m32:300: recipe for target 'libcurl.dll' failed 
mingw32-make[1]: *** [libcurl.dll] Error 1 
mingw32-make[1]: Leaving directory 'D:/Programy/MinGW/cUrl/lib' 
makefile:87: recipe for target 'mingw32-ssl-zlib' failed 
mingw32-make: *** [mingw32-ssl-zlib] Error 2 

我从Shining Light Productions下载cUrl作者v7.40.0和Win64中的OpenSSL v1.0.2a。 据我所知,OpenSSL的这个分布包含libeay32.dlllibssl32.dllssleay32.dll而不是libcrypto.dlllibssl.dll,我没有和编译器正在寻找它。我还检查了我的C:\Windows\System32文件夹中有三个dll。我正在使用MinGW-w64编译器,没有MSYS,版本4.9.2。

为了在Win64上编译带有SSL支持的cUrl库,我需要做些什么?我是否需要修改我的编译命令,某个文件,或者我是否下载了错误版本的OpenSSL?任何帮助是真正的赞赏。

回答

1

... Win64 OpenSSL v1.0.2a from Shining Light Productions. From what I understand, this distribution of OpenSSL contains libeay32.dll, libssl32.dll and ssleay32.dll instead of libcrypto.dll and libssl.dll that I don't have and for for which the compiler is looking for.

OpenSSL应在MSYS Developer Tool Kit中可用。

在安装了开发工具包,只需运行:

mingw32-make mingw32-ssl-zlib 

的MinGW应该找他们,因为他们是在无需OPENSSL_PATH=D:/Programy/MinGW/OpenSSL众所周知的位置。

只需bike shedding:您应该使用no-zlib(或任何选项),因为compression can leak information

+0

我安装了MSYS和它的开发工具包,并将它添加到我的系统环境路径中。当我尝试上面的命令而没有指定'OPENSSL_PATH'时,它会得到一个错误,说它不知道openssl的位置,这很奇怪。 – Tilwaen