Windows上编译最新的CURL,含有zlib,openssl
2015-08-30 11:10
597 查看
最近,从网上下载了一个curl库,使用时各种报错,都无法启动,于是干脆就直接自己编译了。
1. 准备工作
a. 下载zlib
zlib可以使得HTTP请求支持gzip压缩,其地址如下:
官网:http://zlib.net/
下载地址:http://zlib.net/zlib-1.2.8.tar.gz
b. 下载openssl
opensll使用与支持SSL,例如HTTPS的请求。
官网:http://www.openssl.org
下载地址:http://www.openssl.org/source/openssl-1.0.1f.tar.gz
c. 下载curl
官网:http://curl.haxx.se
下载地址:在http://curl.haxx.se/download.html选择你所想要的版本,我这儿选用最新的7.35.0版本 [http://curl.haxx.se/download/curl-7.35.0.tar.gz]
d. 下载ActivePerl
官网:http://www.activestate.com/activeperl/downloads
请注意根据自己的系统版本【32,64】选择不同的安装包【链接失效时用迅雷可下载】
下载地址: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
编译方法:
a. 安装activePerl
直接双击安装,用默认设置就可以了。
b. 解压所有的源码文件,全部放在一个目录下,比如我是房子c:\curl目录下,目录结构如下:
![](https://oscdn.geek-share.com/Uploads/Images/Content/201402/90bdfae9675e0bf56f15bc515917610e)
c. 编译zlib
从开始菜单,选择Microsoft Visual Studio 2005 > Visual Studio Tools > Visual Studio 2005 Command Prompt,如下图:
![](https://oscdn.geek-share.com/Uploads/Images/Content/201402/fa015e1f775cc45a9a40f0bfa194d947)
之后会弹出一个CMD窗口,切换到zlib的目录下C:\curl\zlibxxx,然后输入:
[plain] view
plaincopy
![](https://oscdn.geek-share.com/Uploads/Images/Content/201611/a7c8e286f463007e2a900848b93dd72c.png)
![](https://oscdn.geek-share.com/Uploads/Images/Content/201611/9e12f1d3e499fc949c886e7c9e0484f9)
nmake -f win32/Makefile.msc OBJA="inffast.obj"
![](https://oscdn.geek-share.com/Uploads/Images/Content/201402/349ad7c3fecb9734238200511236b046)
过了一会儿就编译成功。
2. 编译openssl
将当前目录切换到C:\curl\openssl-1.0.1f,如何输入下面执行下面的命令:
[plain] view
plaincopy
![](https://oscdn.geek-share.com/Uploads/Images/Content/201611/a7c8e286f463007e2a900848b93dd72c.png)
![](https://oscdn.geek-share.com/Uploads/Images/Content/201611/9e12f1d3e499fc949c886e7c9e0484f9)
ms\32all.bat
然后就开始了漫长的编译,我这等了15分钟才编译好= =$
![](https://oscdn.geek-share.com/Uploads/Images/Content/201402/4c3b8c734057960f90efd12a5a4e67ef)
3. 编译curllib
将当前目录切换到curl的的目录下C:\curl\curl-7.35.0\lib,然后依次输入一下的命令:
[plain] view
plaincopy
![](https://oscdn.geek-share.com/Uploads/Images/Content/201611/a7c8e286f463007e2a900848b93dd72c.png)
![](https://oscdn.geek-share.com/Uploads/Images/Content/201611/9e12f1d3e499fc949c886e7c9e0484f9)
set OPENSSL_PATH=..\..\openssl-1.0.1f
set ZLIB_PATH=..\..\zlib-1.2.8
nmake -f Makefile.vc8 CFG=release-dll-zlib-dll
注意 Makefile.vc6是VC6.0的版本,VC8是VC2005,VC9是VS2008,依次类推吧。
CFG是配置编译结果选项,其具体内容如下:
[plain] view
plaincopy
![](https://oscdn.geek-share.com/Uploads/Images/Content/201611/a7c8e286f463007e2a900848b93dd72c.png)
![](https://oscdn.geek-share.com/Uploads/Images/Content/201611/9e12f1d3e499fc949c886e7c9e0484f9)
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 dynamic 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 dynamic 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 dynamic zlib
<target> can be left blank in which case all is assumed
Makefile.vc8(501) : fatal error U1050: please choose a valid configuration "rele
ase-dll-ssl-dll-zlib-dll "
Stop.
大家可以根据自己的需要编译不同的DLL和lib,我就选择编译了两个静态库:
[plain] view
plaincopy
![](https://oscdn.geek-share.com/Uploads/Images/Content/201611/a7c8e286f463007e2a900848b93dd72c.png)
![](https://oscdn.geek-share.com/Uploads/Images/Content/201611/9e12f1d3e499fc949c886e7c9e0484f9)
nmake -f Makefile.vc8 CFG=release-ssl-zlib
nmake -f Makefile.vc8 CFG=debug-ssl-zlib
![](https://oscdn.geek-share.com/Uploads/Images/Content/201402/712f73b5c1bf8b894bbc5ca8295642b8)
然后就是开始华丽丽的刷屏等待啦~~~
过了几分钟之后,就编译好了,将C:\curl\curl-7.35.0\lib\会有debug-ssl-zlib和release-ssl-zlib目录,拷贝到VS的工程目下,然后配置一下就可以使用了。
来源:/article/9628674.html
1. 准备工作
a. 下载zlib
zlib可以使得HTTP请求支持gzip压缩,其地址如下:
官网:http://zlib.net/
下载地址:http://zlib.net/zlib-1.2.8.tar.gz
b. 下载openssl
opensll使用与支持SSL,例如HTTPS的请求。
官网:http://www.openssl.org
下载地址:http://www.openssl.org/source/openssl-1.0.1f.tar.gz
c. 下载curl
官网:http://curl.haxx.se
下载地址:在http://curl.haxx.se/download.html选择你所想要的版本,我这儿选用最新的7.35.0版本 [http://curl.haxx.se/download/curl-7.35.0.tar.gz]
d. 下载ActivePerl
官网:http://www.activestate.com/activeperl/downloads
请注意根据自己的系统版本【32,64】选择不同的安装包【链接失效时用迅雷可下载】
下载地址: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
编译方法:
a. 安装activePerl
直接双击安装,用默认设置就可以了。
b. 解压所有的源码文件,全部放在一个目录下,比如我是房子c:\curl目录下,目录结构如下:
c. 编译zlib
从开始菜单,选择Microsoft Visual Studio 2005 > Visual Studio Tools > Visual Studio 2005 Command Prompt,如下图:
之后会弹出一个CMD窗口,切换到zlib的目录下C:\curl\zlibxxx,然后输入:
[plain] view
plaincopy
![](https://oscdn.geek-share.com/Uploads/Images/Content/201611/a7c8e286f463007e2a900848b93dd72c.png)
nmake -f win32/Makefile.msc OBJA="inffast.obj"
过了一会儿就编译成功。
2. 编译openssl
将当前目录切换到C:\curl\openssl-1.0.1f,如何输入下面执行下面的命令:
[plain] view
plaincopy
![](https://oscdn.geek-share.com/Uploads/Images/Content/201611/a7c8e286f463007e2a900848b93dd72c.png)
ms\32all.bat
然后就开始了漫长的编译,我这等了15分钟才编译好= =$
3. 编译curllib
将当前目录切换到curl的的目录下C:\curl\curl-7.35.0\lib,然后依次输入一下的命令:
[plain] view
plaincopy
![](https://oscdn.geek-share.com/Uploads/Images/Content/201611/a7c8e286f463007e2a900848b93dd72c.png)
set OPENSSL_PATH=..\..\openssl-1.0.1f
set ZLIB_PATH=..\..\zlib-1.2.8
nmake -f Makefile.vc8 CFG=release-dll-zlib-dll
注意 Makefile.vc6是VC6.0的版本,VC8是VC2005,VC9是VS2008,依次类推吧。
CFG是配置编译结果选项,其具体内容如下:
[plain] view
plaincopy
![](https://oscdn.geek-share.com/Uploads/Images/Content/201611/a7c8e286f463007e2a900848b93dd72c.png)
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 dynamic 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 dynamic 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 dynamic zlib
<target> can be left blank in which case all is assumed
Makefile.vc8(501) : fatal error U1050: please choose a valid configuration "rele
ase-dll-ssl-dll-zlib-dll "
Stop.
大家可以根据自己的需要编译不同的DLL和lib,我就选择编译了两个静态库:
[plain] view
plaincopy
![](https://oscdn.geek-share.com/Uploads/Images/Content/201611/a7c8e286f463007e2a900848b93dd72c.png)
nmake -f Makefile.vc8 CFG=release-ssl-zlib
nmake -f Makefile.vc8 CFG=debug-ssl-zlib
然后就是开始华丽丽的刷屏等待啦~~~
过了几分钟之后,就编译好了,将C:\curl\curl-7.35.0\lib\会有debug-ssl-zlib和release-ssl-zlib目录,拷贝到VS的工程目下,然后配置一下就可以使用了。
来源:/article/9628674.html
相关文章推荐
- linux下修改path
- 简单之美-Dubbo架构设计详解
- Tomcat介绍及性能优化
- 我的openwrt学习笔记(十九):linux便捷开发命令之strace
- Hbase架构简介、实践
- Linux系统查找
- Apache+Tomcat集群配置
- Photo Shop
- 玩玩负载均衡---在window与linux下配置nginx
- Codeforces 436C Gargari and Bishops
- CentOS 6.5 32-bit 配置IP地址
- Centos下Yum安装PHP5.5,5.6
- linux学习--扫盲笔记
- 高性能网站建设的14个原则
- opencv widthstep 理解
- OpenStack之学习资料
- linux命令汇总(mkdir、rmdir、touch、dirname、basename)
- 使用createrepo自建yum源
- php5+apache2+mysql环境安装authpuppy
- MacBook Pro (OS X yosemite 10.10.5) 安装opencv2.4.10过程