libcurl交叉编译arm版本动态库

前言

最近由于项目需要要进行交叉编译libcurl以完成https通信。这里记录一下过程。

首先下载最新版本的源码文件,并解压,如下:

libcurl交叉编译arm版本动态库_第1张图片
image.png

我用的deepin自带交叉编译工具链,sudo apt install gcc-5-arm-linux-gnueabihf安装就可以了。

arm-linux内容

libcurl交叉编译arm版本动态库_第2张图片
image.png

在openssl目录下运行以下命令:

source ../arm-linux
./Configure --prefix=$(pwd)/../output shared no-asm linux-armv4
make -j4
make install

首先导入环境变量。然后进行编译,输出路径在output下面。

然后在libcurl 下运行以下命令

source ../arm-linux
./configure --with-ssl=$(pwd)/../output --prefix=$PWD/../output --build=x86_64-pc-linux-gnu --host=arm-linux-gnueabihf  CC=arm-linux-gnueabihf-gcc-5 --without-zlib

curl配置结果一览

  curl version:     7.58.0
  Host setup:       x86_64-pc-linux-gnu
  Install prefix:   /media/linan/72605383-b1ba-4c79-90fd-443514396fbc/curl_workdir/curl-7.58.0/output
  Compiler:         arm-linux-gnueabihf-gcc-5
  SSL support:      enabled (OpenSSL)
  SSH support:      no      (--with-libssh2)
  zlib support:     no      (--with-zlib)
  brotli support:   no      (--with-brotli)
  GSS-API support:  no      (--with-gssapi)
  TLS-SRP support:  enabled
  resolver:         POSIX threaded
  IPv6 support:     enabled
  Unix sockets support: enabled
  IDN support:      no      (--with-{libidn2,winidn})
  Build libcurl:    Shared=yes, Static=yes
  Built-in manual:  enabled
  --libcurl option: enabled (--disable-libcurl-option)
  Verbose errors:   enabled (--disable-verbose)
  SSPI support:     no      (--enable-sspi)
  ca cert bundle:   no
  ca cert path:     no
  ca fallback:      no
  LDAP support:     no      (--enable-ldap / --with-ldap-lib / --with-lber-lib)
  LDAPS support:    no      (--enable-ldaps)
  RTSP support:     enabled
  RTMP support:     no      (--with-librtmp)
  metalink support: no      (--with-libmetalink)
  PSL support:      no      (libpsl not found)
  HTTP2 support:    disabled (--with-nghttp2)
  Protocols:        DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP

然后在运行make 以及make install,在curl目录下就会出现output目录。

最终,我们需要的是openssl以及curl的动态库,分别是:libssl.so libcrypto.so libcurl.so

你可能感兴趣的:(libcurl交叉编译arm版本动态库)