Curl的编译
下载
curl的官网:https://curl.haxx.se/
libcurl就是一个库,curl就是使用libcurl实现的。
curl是一个exe,也可以说是整个项目的名字,而libcurl就是一个独立的库,所以做二次开发一般就使用库,当然为了简单也可以直接用curl.exe来完成。
curl只提供了源码的方式:https://curl.haxx.se/download.html,其他的方式都是第三方自己编译发布的。
curl下载安装的方式参考:https://curl.haxx.se/dlwiz/
curl executable - You will get a pre-built 'curl' binary from this link (or in some cases, by using the information that is provided at the page this link takes you). You may or may not get 'libcurl' installed as a shared library/DLL.
libcurl development - This is for libcurl development - but does not always contain libcurl itself. Most likely header files and documentation. If you intend to compile or build something that uses libcurl, this is most likely the package you want.
libcurl - This is a pure binary libcurl package, possibly including header files and documentation, but without the command line tool and other cruft. If you want libcurl for a program that uses libcurl, this is most likely the package you want.
source code - You will not download a pre-built binary from this link. You will instead get a link to site with the curl source, adjusted for your platform. You will need to have a compiler setup and working to be able to build curl from a source package.
Show All - Display all known package types.
这里的下载方式多数也是其他商家提供的,除了源码和可执行程序以外。
比如libcurl dev就没有windows平台的。
比如libcurl就是cygwin提供的,所以他的库也是用于cygwin的。
而sourcecode就可以下载平台独立的包,但是不是最新的。所以直接在https://curl.haxx.se/download.html页面下载即可。
下面就是主页下载的图片:
我们就下载zip版本:
官方资料
https://curl.haxx.se/libcurl/c/
https://curl.haxx.se/libcurl/c/libcurl-tutorial.html
其他的HTTPClient
libcurl (MIT)
- a highly portable and easy-to-use client-side URL transfer library, supporting DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP. libcurl also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading, kerberos, HTTP form based upload, proxies, cookies, user+password authentication, file transfer resume, http proxy tunnelling and more!
libghttp (LGPL)
- Having a glance at libghttp (a gnome http library), it looks as if it works rather similar to libcurl (for http). There's no web page for this and the person who's email is mentioned in the README of the latest release I found claims he has passed the leadership of the project to "eazel". Popular choice among GNOME projects.
libwww (W3C license) comparison with libcurl
- More complex and harder to use than libcurl is. Includes everything from multi-threading to HTML parsing. The most notable transfer-related feature that libcurl does not offer but libwww does, is caching.
libferit (GPL)
- C++ library "for transferring files via http, ftp, gopher, proxy server". Based on 'snarf' 2.0.9-code (formerly known as libsnarf). Quote from freshmeat:
"As the author of snarf, I have to say this frightens me. Snarf's networking system is far from robust and complete. It's probably full of bugs, and although it works for maybe 85% of all current situations, I wouldn't base a library on it."
neon (LGPL) comparison with neon
- An HTTP and WebDAV client library, with a C interface. I've mainly heard and seen people use this with WebDAV as their main interest. This is one of the two alternatives used by the Subversion project.
libsoup (LGPL) comparison with libcurl
- Part of glib (GNOME). Supports: HTTP 1.1, Persistent connections, Asynchronous DNS and transfers, Connection cache, Redirects, Basic, Digest, NTLM authentication, SSL with GnuTLS, Proxy support including SSL, POST data. Not portable. Lacks: cookie support, NTLM for proxies, GSS, gzip encoding, trailers in chunked responses, portability and more.
mozilla netlib (MPL)
- Handles URLs, protocols, transports for the Mozilla browser.
mozilla libxpnet (MPL)
- Minimal download library targeted to be much smaller than the above mentioned netlib. HTTP and FTP support.
wget (GPL)
- While not a library at all, I've been told that people sometimes extract the network code from it and base their own hacks from there.
libfetch (BSD)
- Does HTTP and FTP transfers (both ways), supports file: URLs, and an API for URL parsing. The utility
fetch
- that is built on libfetch is an integral part of the
- operating system.
HTTP Fetcher (LGPL)
- "
a small, robust, flexible library for downloading files via HTTP using the GET method.
- "
http-tiny (Artistic License)
- "
a very small C library to make http queries (GET, HEAD, PUT, DELETE, etc.) easily portable and embeddable
- "
wininet comparison with libcurl
"The Windows Internet (WinINet) application programming interface (API) enables applications to interact with Gopher, FTP, and HTTP protocols to access Internet resources."
XMLHTTP Object also known as IXMLHTTPRequest (part of MSXML 3.0)
- (Windows) Provides client-side protocol support for communication with HTTP servers. A client computer can use the XMLHTTP object to send an arbitrary HTTP request, receive the response, and have the Microsoft® XML Document Object Model (DOM) parse that response.
QHttp (GPL)
- QHttp is a class in the Qt library from Troll Tech. Seems to be restricted to plain HTTP. Supports GET, POST and proxy. Asynchronous.
ftplib (GPL)
- "
a set of routines that implement the FTP protocol. They allow applications to create and access remote files through function calls instead of needing to fork and exec an interactive ftp client program."
- I stopped using it because it did not evolve and the maintainer did not even answer to my e-mailed patches and forum posts. The web site seems abandoned and the forum is not reachable anymore. It is simpler to use than libcurl, because it is not based on callbacks. But is is also much less powerful. /
ftplib++ (GPL)
- A C++ library for "easy FTP client functionality. It features resuming of up- and downloads, FXP support, SSL/TLS encryption, and logging functionality."
- Has a URLStream class. This C++ class allow you to download a file using HTTP. See demo/urlfetch.cpp in commoncpp2-1.3.19.tar.gz
HTTPClient (LGPL)
- Java HTTP client library.
Jakarta Commons HttpClient (Apache License)
- A Java HTTP client library written by the Jakarta project.
gnetlibrary (LGPL)
"a simple network library. It is written in C, object-oriented, and built upon GLib. It is intended to be easy to use and port"
- . Features a HTTP component. It uses glib, and integrates very well within Gtk+ applications, which require event-driven programming.
Serf (Apache License)
"The serf library is a C-based HTTP client library built upon the Apache Portable Runtime (APR) library. It multiplexes connections, running the read/write communication asynchronously."
- This is one of the two alternatives used by the Subversion project.
qDecoder (BSD)
- qDecoder is a development kit for C/C++ network programming includes simple
- .
编译
在curl的官方文档里面没有看到readme有讲解怎么使用,编译,安装等。但是肯目录结构也能猜出来...
就是在projects下面就有使用IDE编译的说明。还有一种编译方式,直接用命令的方式,参考:curl-7.50.1\winbuild
1.先用generate.bat生成项目文件
2.下载依赖库
下载的依赖库最好都应该放到同一个目录,跟curl是同一级的目录
1) activeperl
下载地址:http://www.activestate.com/activeperl/downloads
2) openssl
“openssl/ssl.h”: No such file or directory
https://www.openssl.org/source/
参考文件:INSTALL.W32
1.配置:openssl-1.0.2h>perl Configure VC-WIN32 --prefix=E:\openssl (我们不需要汇编asm,所以不用这个方案)
perl Configure VC-WIN32 no-asm --prefix=E:/openssl/
2.ms\do_nasm(我们不需要汇编asm,所以不用这个方案)
ms\do_ms
3.换用vs的命令行工具,切换到根目录,然后,输入:nmake -f ms\ntdll.mak
错误:
cryptlib.obj : error LNK2001: 无法解析的外部符号 _OPENSSL_ia32cap_P
cryptlib.obj : error LNK2019: 无法解析的外部符号 _OPENSSL_ia32_cpuid,该符号在函数 _OPENSSL_cpuid_setup 中被引用
这个错误的原因是之前编译的临时文件没有清理的问题,因为我之前编译的时候没有添加no-asm选项,后面加上时没有清理就直接编译了,那肯定有问题。
所以重新清理下再编译即可(清理方式就是重新解压一份原来的压缩包,重新来就是了)
4.测试
nmake -f ms\ntdll.mak test
5.安装
nmake -f ms\ntdll.mak install
安装完成之后就是如下目录:
3) Zlib
zlib需要用makefile(zlib128\zlib-1.2.8\win32)编译(或者用VS也可以:zlib128\zlib-1.2.8\contrib\vstudio\vc10)
用makefile就需要启动VS的命令提示符来进行编译:
切换到zlib目录,然后输入nmake -f win32/Makefile.msc
下面是编译完成之后的截图:
4) libssh2
下载地址:https://www.libssh2.org/download/libssh2-1.7.0.tar.gz
打开:libssh2-1.7.0\win32\libssh2.dsw
5) pthread
ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip
这是一家编译好的版本,直接用就是了
3.使用VS编译Curl
在project下面,根据自己的VS版本类型,选择对应的目录进去即可。
1) 配置libcurl依赖库的头文件路径
2) 配置libcurl库的lib路径
3) 修改依赖的库
由于我们的VS环境可能已经配置了其他的默认的一些库,所以这里编译就可能导致依赖的不相关的库找不到。
于是我们就不从父级继承,而是直接把kernel32.lib和user32.lib添加上即可
4) 生成libcurl
5) 同样,修改curl的lib
6) 生成curl
头文件路径
curl-7.50.1\include
Curl的编译的更多相关文章
- curl+openssl编译
curl不支持openssl的静态库,所以编译openssl的时候,应该加上shared 参数,记录一下我亲手编译的参数: ./configure --prefix=/usr/local/openss ...
- lua curl动态链接库编译安装
关于lua curl的资料网上并不是很多.找来找去就那么几个,所以我绝得很有必要把我的经验记下来,以防下次忘记 ...
- lua curl动态链接库编译安装(二)
下面再介绍一下lua-curl中的lua-curl-0.2.tar.gz版本的安装方法,可能对于一般的人来说这个很简单,但是对于我们这些菜鸟来说就不一样了: # wget http://files.l ...
- 嵌入式 Linux下编译并使用curl静态库
#x86 ./configure --disable-shared --enable-static --disable-ftp --disable-ipv6 --disable-rtsp --disa ...
- centos7.6编译安装php7.2.11及redis/memcached/rabbitmq/openssl/curl等常见扩展
centos7.6编译安装php7..11及redis/memcached/rabbitmq/openssl/curl等常见扩展 获取Php的编译参数方法: [root@eus-api-cms-bac ...
- 解决PHP编译cURL的reinstall the libcurl问题
今天正好要用到PHP的curl功能,发现服务器上的PHP并没有配置curl,进而查询PHP官方文档,得知编译PHP时需要带上 –with-curl参数,才能把curl模块编译进去.我现在PHP已经编译 ...
- Curl的移植编译以及注意事项
最近需要用curl来发送http请求,遇到了不少问题,查了不少资料,都是零零散散的,现在总结下. 1.移植编译 ./configure --prefix=$(PWD)/build --host=a ...
- [转][linux][centos]嵌入式 Linux下编译并使用curl静态库
#x86 ./configure --disable-shared --enable-static --disable-ftp --disable-ipv6 --disable-rtsp --disa ...
- php 未配置curl
用到PHP的curl功能,发现服务器上的PHP并没有配置curl,进而查询PHP官方文档,得知编译PHP时需要带上 –with-curl参数,才能把curl模块编译进去.我现在PHP已经编译安装进服务 ...
随机推荐
- spring利用javamail,quartz定时发送邮件 <转>
原文地址:spring利用javamail,quartz定时发送邮件 <转>作者:物是人非 spring提供的定时发送邮件功能,下面是一个简单的例子以供大家参考,首先从spring配置文件 ...
- Learn_Dynamic
首先看一下Dynamic的定义 Visual C# 2010 引入了一个新类型 dynamic. 该类型是一种静态类型,但类型为 dynamic 的对象会跳过静态类型检查. 大多数情况下,该对象就像具 ...
- 原生js操作cookie
写cookie function setCookie(name,value) { var Days = 30; var exp = new Date(); exp.setTime(exp.getTim ...
- git拉取远程分支并创建本地分支和Git中从远程的分支获取最新的版本到本地
git拉取远程分支并创建本地分支 一.查看远程分支 使用如下Git命令查看所有远程分支: git branch -r 二.拉取远程分支并创建本地分支 方法一 使用如下命令: git checkout ...
- cocos2d-x sprite触摸处理
转自:http://www.cnblogs.com/lancidie/archive/2013/04/01/2993890.html 我们常常需要判断用户的点击操作是否落于某个sprite之上,进而让 ...
- JS获取客户端电脑信息(转)
<html> <head> <title></title> <script type="text/javascript"> ...
- js Uncaught SyntaxError: Unexpected token错误
今天遇到js报错Uncaught SyntaxError: Unexpected token 不知道是什么原因,并且js还会继续往下执行. 经过排查竟然是在保存行的上面有个if少一个大括号,真是坑爹啊 ...
- 关于android的Activity的四种启动模式
最近做项目遇到一个问题,当触摸屏幕的时候通过intent启动activity,发现会启动多次,而后查阅资料,发现,原来是activity的模式设置问题. Activity的启动模式可以通过Androi ...
- [WebGL入门]二,開始WebGL之前,先了解一下canvas
年2月)HTML5依旧处于草案阶段. HTML5支持网页端的多媒体功能和画布功能,追加了非常多全新的更合理的Tag标签.各个浏览器也都在逐渐的完好这些新的特性. Canvas对象表示一个 HTML画布 ...
- 面试题总结之Database
SQL 1. 现有一张学生表,有只有一个列是名字,请选出其中的重名的学生的名字select name from student group by name having count(*) > 1 ...