下载源代码
curl downloadshttps://curl.se/download/
选择需要下载的版本,我下载的是8.11.0

解压
tar -zxvf curl-8.11.0
查看安装命令
查找INSTALL.md,一般在docs文件夹下


--prefix= :指定安装路径(默认安装在/usr/local)
--host= : 可以指定交叉编译工具(如果不需要交叉编译就不用指定)
--with-ssl:这个参数会使./configure在安装的时候依赖openssl,如果openssl安装在默认路径则(/usr/local/ssl)直接使用"--with-ssl"这个参数,如果安装在其他路径,则需要指定ssl的路径。如"--with-ssl=/xxx/xxx"
配置编译选项
./configure --with-ssl=/usr/include/openssl
问题:
如果报错如下
configure: error: /usr/include/openssl is a bad --with-openssl prefix
修改命令执行
./configure --with-openssl=/usr
如果提示,无法检测Openssl,说明我们没有安装Openssl
如果,代表缺少libpsl

安装
下载
https://www.linuxfromscratch.org/blfs/view/svn/basicnet/libpsl.html
解压

配置构建
./configure --prefix=/usr --with-ssl
编译
make
sudo make install
更新动态链接库缓存:
安装完成后,运行ldconfig更新系统的动态链接库缓存:
sudo ldconfig
ldconfig -p | grep libpsl

编译和安装
make
sudo make install
检查是否成功
ldconfig -p | grep libcurl
