linux curl 交叉编译,如何交叉编译curl?

本文详细介绍了如何交叉编译curl库,以适应ARM架构的Linux系统。首先,编译了openssl库,然后下载并解压curl源码。配置步骤中,设置了必要的CPPFLAGS、LDFLAGS和LIBS变量,指定openssl路径,并使用arm-linux-gcc进行编译。在make和make install之后,curl库即可在目标平台上使用。
摘要由CSDN通过智能技术生成

如何交叉编译curl?

1. 先准备一下openssl库

编译openssl库的方法在此

2. 获取curl源码

wget https://curl.haxx.se/download/curl-7.65.3.tar.gz

2. 解压

tar xvf curl-7.65.3.tar.gz -C ~/

cd ~/curl-7.65.3

3. 配置

CPPFLAGS="-I/home/jello/openssl/ -I/home/jello/openssl/include" LDFLAGS="-L/home/jello/openssl/lib" LIBS="-ldl" ./configure --host=arm-linux CC=arm-linux-gcc CXX=arm-linux-g++ --with-ssl --enable-shared --enable-static --disable-dict --disable-ftp --disable-imap --disable-ldap --disable-ldaps --disable-pop3 --disable-proxy --disable-rtsp --disable-smtp --disable-telnet --disable-tftp --disable-zlib --without-ca-bundle --without-gnutls --without-libidn --without-librtmp --without-libssh2 --without-nss --without-zlib --prefix=/home/jello/curl

4. 编译

make -j4

5. 安装

make install

注意:configure  是由另一个buildconf 文件生成的。注意LIBS 要链接具体的三个库,否则链接时候会出错。CPPFLAGS="-I/home/gerry01/imx6q/openssl -I/home/gerry01/imx6q/openssl/include" LDFLAGS="-L/home/gerry01/imx6q/openssl/lib" LIBS="-ldl -lssl -lcrypto" ./configure --host=arm-linux CC=/opt/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc CXX=/opt/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ --with-ssl --enable-shared --enable-static --disable-dict --disable-ftp --disable-imap --disable-ldap --disable-ldaps --disable-pop3 --disable-proxy --disable-rtsp --disable-smtp --disable-telnet --disable-tftp --disable-zlib --without-ca-bundle --without-gnutls --without-libidn --without-librtmp --without-libssh2 --without-nss --without-zlib --prefix=/home/gerry01/imx6q/curl

2662eaf66f000455ab1a2fcabad2a375.png

*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值