库编译:curl linux arm 编译

一 概述

curl是一个利用URL语法在命令行下工作的文件传输工具,1997年首次发行。它支持文件上传和下载,所以是综合传输工具。在http https 通信中经常用到, 将编译方法总结分享出来。

二 下载 解压 curl

wget http://curl.haxx.se/download/curl-7.63.0.tar.gz
tar -xvzf curl-7.63.0.tar.gz

三 编译curl

Linux 编译

./configure --prefix=/usr/local/curl --disable-shared --enable-static --without-libidn --without-ssl --without-librtmp --without-gnutls --without-nss --without-libssh2 --without-zlib --without-winidn --disable-rtsp --disable-ldap --disable-ldaps --disable-ipv6
make
sudo make install

Arm 编译

./configure --host=arm-linux CC=arm-hisiv600-linux-gcc CXX=arm-hisiv600-linux-g++ --disable-shared --enable-static --without-libidn --without-ssl --without-librtmp --without-gnutls --without-nss --without-libssh2 --without-zlib --without-winidn --disable-rtsp --disable-ldap --disable-ldaps --disable-ipv6 --prefix=/home/xhw/share/arm/arm_hisi/curl
make
make install

四 学习文档

https://blog.csdn.net/andylauren/article/details/78821916

五 错误记录

1 使用curl静态库生成其他动态库 报如下错误:
/usr/local/lib/libcurl.a: could not read symbols: Bad value
解决方案:
在./configure 最后面增加 CFLAGS=-fPIC CPPFLAGS=-fPIC 配置

Linux 18.04下进行交叉编译,以生成ARM架构的静态,你需要安装交叉编译工具链,配置好环境变量,并且根据目标平台进行相应的编译设置。以下是交叉编译gmssl与curl生成ARM64(aarch64)架构的.a静态的大致步骤: 1. 安装交叉编译工具链: 通常,你可以使用`apt-get`来安装针对ARM架构的交叉编译工具链。例如: ```bash sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu ``` 这将安装适用于ARM64架构的GCC和G++编译器。 2. 设置环境变量: 为了简化编译命令,设置环境变量`CC`和`CXX`为交叉编译器: ```bash export CC=aarch64-linux-gnu-gcc export CXX=aarch64-linux-gnu-g++ ``` 3. 获取gmssl与curl源代码: 从各自的官方网站或者代码仓下载gmssl和curl的源代码。 4. 交叉编译gmssl: 在gmssl源代码目录下,你可以使用`./configure`命令配置交叉编译选项,如果`./configure`没有提供直接支持ARM架构的选项,你可能需要手动指定交叉编译相关的配置,例如: ```bash ./configure --host=aarch64-linux-gnu --prefix=/path/to/output/directory --disable-shared --enable-static make make install ``` 这里`--host`指定了目标架构,`--prefix`指定了安装目录,`--disable-shared`和`--enable-static`指定了生成静态。 5. 交叉编译curl: 对于curl的交叉编译,步骤与gmssl类似,但可能需要额外的配置选项来确保正确链接到gmssl。例如: ```bash ./configure --host=aarch64-linux-gnu --prefix=/path/to/output/directory --with-gmssl=/path/to/gmssl --disable-shared --enable-static make make install ``` 注意替换`/path/to/gmssl`为gmssl静态的实际路径,确保curl编译时能够找到gmssl的头文件和文件。 6. 验证文件: 最后,在指定的输出目录中,你应该能找到生成的静态文件(.a文件)。 请记住,这些步骤可能会根据你的具体环境和项目要求有所不同。在编译过程中,可能需要调整编译参数和路径设置,以确保正确完成交叉编译过程。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值