后端开发之libcurl库编译与安装

12 篇文章 0 订阅
10 篇文章 0 订阅

curl 是以URL语法来传输输出的一个命令行工具。libcurl 是对对其功能的封装,实现了命令行工具的所有功能。
curl 支持HTTP、HTTPS、FTP、FTPS、DICT、TELNET、LDAP、FILE,和GOPHER协议。
libcurl 使用C语言编写。本文介绍在Linux,Windows的下的编译方法。这其中会用到cmake,gcc,visual c++ 2017(windows 下msvc方式编译)。

下载libcurl源码

从GitHub或者Gitee都有镜像可以下载。

    git clone --depth=1 https://github.com/curl/curl.git

下载后libcurl 7.73.0

Linux下编译

  • 生成configure
  • 运行./configure
  • make & make install

如果需要编译例子,可以执行如下命令

make test

windows下编译

配置OpenSSL

下载最新版本

git clone https://github.com/openssl/openssl.git
编译OpenSSL,按照文档NOTES-Windows要求,

  1. 安装Perl
  2. 安装NASM,并设置%PATH%路径
  3. 打开Cmd工具,配置VC编译环境,运行Visual Studio 里面的vcvarsall.bat, 选择要启动的编译环境例如:x86
  4. 运行命令perl Configure VC-WIN32(编译32位 OpenSSL)
  5. 执行nmake
  6. nmake install
编译输出库

命令行进入Curl源码文件夹:

cd curl-src\winbuild

执行命令 nmake /f Makefile.vc,如果要输出到The builds will be in the top src directory, builds\ directory, in
a directory named using the options given to the nmake call.

nmake /f Makefile.vc mode=<static or dll> <options>
options:  
- `VC=<6,7,8,9,10,11,12,14,15>` - VC version
- `SSL_PATH=<path>`             - Custom path for OpenSSL
- `WITH_SSL=<dll/static>`       - Enable OpenSSL support, DLL or static
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值