zoukankan      html  css  js  c++  java
  • VC++ 编译libcurl 支持SSL,GZIP(有脚本)

    由于网上下载的 libcurl 不支持 gzip,只好自己动手编译,期间走了很多弯路,下面是最终成功的记录。

    我所使用的环境 Visual Studio 2010 、 Windows 7 64 bit

    1 下载文件

    1.1 libcurl

    下载页面 http://curl.haxx.se/download.html

    下载地址 http://curl.haxx.se/download/curl-7.26.0.zip

    1.2 zlib

    下载页面 http://sourceforge.net/projects/libpng/files/zlib/

    下载地址 http://sourceforge.net/projects/libpng/files/zlib/1.2.5/zlib125.zip/download

    (特别提醒,不要使用1.2.7版编译,使用后发现编译的方法和文件名都不同了)

    1.3 openssl

    下载页面 http://www.openssl.org/source/

    下载地址 http://www.openssl.org/source/openssl-1.0.0c.tar.gz

    (特别提醒,不建议用1.0.1c,虽可编译成功,但无法绕过SSL证书,不知其原因,浪费了我不少时间)

    编译openssl还需下载ActivePerl

    官方下载 http://www.activestate.com/activeperl/downloads

    下载地址:http://downloads.activestate.com/ActivePerl/releases/5.16.0.1600/ActivePerl-5.16.0.1600-MSWin32-x86-295879.msi

    X64下载地址:http://downloads.activestate.com/ActivePerl/releases/5.16.0.1600/ActivePerl-5.16.0.1600-MSWin32-x64-295879.msi

    2 解压及安装文件

    2.1 ActivePerl安装,双击直接下一步,默认设置到底。

    2.2 zlib openssl libcurl分别解压,他们三个在同一级目录。

    例如:D:UserDeweiTestCurlcurl-7.26.0、D:UserDeweiTestCurlopenssl-1.0.0c、D:UserDeweiTestCurlzlib-1.2.5

    3 编译过程

    3.1 zlib编译

    用vs2010打开zlib-1.2.5/old/visualc6/zlib.dsw,选择DLL_Release编译,把编译生成的zlib-1.2.5/old/visualc6/Win32_DLL_Release/ zlib1.lib 复制到curl-7.26.0/lib目录下,重命名为 zdll.lib (注意必须为此文件名) 。

    3.2 openssl编译

    打开cmd,cd到openssl-1.0.0c目录下;

    运行命令 perl Configure VC-WIN32

    再运行 msdo_ms.bat

    再运行 “C:Program Files (x86)Microsoft Visual Studio 10.0vcvars32.bat”

    运行命令 nmake -f ms/ntdll.mak

    参考资料:openssl-1.0.0c/INSTALL.W32

    3.3 编译curl-7.26.0

    在curl-7.26.0/lib目录下新建release.bat,输入以下内容

    call “C:/Program Files/Microsoft Visual Studio 10.0/VC/bin/vcvars32.bat”
    set CFG=release-dll-ssl-dll-zlib-dll
    set OPENSSL_PATH=../../openssl-1.0.0c
    set ZLIB_PATH=../../zlib-1.2.5
    nmake -f Makefile.vc10

    保存,然后运行。

    等待一会儿,就可以到 curl-7.26.0librelease-dll-ssl-dll-zlib-dll 目录下拷文件 libcurl_imp.lib和libcurl.dll 啦!

    参考资料:curl-7.26.0/docs/INSTALL

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    20

    21

    22

    23

    24

    25

    26

    27

    28

    29

    30

    Usage: nmake /f makefile.vc6 CFG=<config> <target>

    where <config> is one of:

    release - release static library

    release-ssl - release static library with ssl

    release-zlib - release static library with zlib

    release-ssl-zlib - release static library with ssl and zlib

    release-ssl-ssh2-zlib - release static library with ssl, ssh2 and zlib

    release-ssl-dll - release static library with dynamic ssl

    release-zlib-dll - release static library with dynamic zlib

    release-ssl-dll-zlib-dll - release static library with dynamic ssl and dynam

    ic zlib

    release-dll - release dynamic library

    release-dll-ssl-dll - release dynamic library with dynamic ssl

    release-dll-zlib-dll - release dynamic library with dynamic zlib

    release-dll-ssl-dll-zlib-dll - release dynamic library with dynamic ssl and dyna

    mic zlib

    debug - debug static library

    debug-ssl - debug static library with ssl

    debug-zlib - debug static library with zlib

    debug-ssl-zlib - debug static library with ssl and zlib

    debug-ssl-ssh2-zlib - debug static library with ssl, ssh2 and zlib

    debug-ssl-dll - debug static library with dynamic ssl

    debug-zlib-dll - debug static library with dynamic zlib

    debug-ssl-dll-zlib-dll - debug static library with dynamic ssl and dynamic

    zlib

    debug-dll - debug dynamic library

    debug-dll-ssl-dll - debug dynamic library with dynamic ssl

    debug-dll-zlib-dll - debug dynamic library with dynamic zlib1

    debug-dll-ssl-dll-zlib-dll - debug dynamic library with dynamic ssl and dynami

    c zlib

    本文出自 王牌软件,转载时请注明出处及相应链接。

    本文永久链接: http://www.softwareace.cn/?p=525

    http://www.yaoguangkeji.com/a_W3V5MKwb.html

  • 相关阅读:
    awk命令使用整理
    oracle pl/sql中record和%rowtype整理
    expect实现非交互下的ssh连接, expect简单使用整理
    shell通配符, 变量, shell作用域, $#@*等说明
    python之爬虫(三) Urllib库的基本使用
    python之爬虫(二)爬虫的原理
    python之爬虫--番外篇(一)进程,线程的初步了解
    Python之Web框架
    Python之爬虫
    Django【进阶篇 】
  • 原文地址:https://www.cnblogs.com/findumars/p/7496132.html
Copyright © 2011-2022 走看看