无法创建共享的 curl 库

Can not make shared curl library

我正在为 arm board 交叉编译 curl 库。 所以我像这样在 curl 库目录中使用配置脚本文件配置 Makefile。

./configure --disable-static --enable-shared --with-ssl=/tmp/openssl --prefix=/tmp/curl --host=arm

但是结果总是静态库。我该如何解决?

配置结果

  Host setup:       arm-unknown-none
  Install prefix:   /tmp/curl
  Compiler:         arm-linux-gnueabihf-gcc
   CFLAGS:          -Werror-implicit-function-declaration -O2 -Wno-system-headers -pthread
   CPPFLAGS:        -isystem /tmp/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED
   LDFLAGS:         -L/tmp/openssl/lib
   LIBS:            -lssl -lcrypto -lssl -lcrypto

  curl version:     7.73.0
  SSL:              enabled (OpenSSL v3+)
  SSH:              no      (--with-{libssh,libssh2})
  zlib:             no      (--with-zlib)
  brotli:           no      (--with-brotli)
  zstd:             no      (--with-zstd)
  GSS-API:          no      (--with-gssapi)
  TLS-SRP:          enabled
  resolver:         POSIX threaded
  IPv6:             enabled
  Unix sockets:     enabled
  IDN:              no      (--with-{libidn2,winidn})
  Build libcurl:    Shared=no, Static=yes
  Built-in manual:  enabled
  --libcurl option: enabled (--disable-libcurl-option)
  Verbose errors:   enabled (--disable-verbose)
  Code coverage:    disabled
  SSPI:             no      (--enable-sspi)
  ca cert bundle:   no
  ca cert path:     no
  ca fallback:      no
  LDAP:             no      (--enable-ldap / --with-ldap-lib / --with-lber-lib)
  LDAPS:            no      (--enable-ldaps)
  RTSP:             enabled
  RTMP:             no      (--with-librtmp)
  Metalink:         no      (--with-libmetalink)
  PSL:              no      (libpsl not found)
  Alt-svc:          no      (--enable-alt-svc)
  HTTP2:            no      (--with-nghttp2)
  HTTP3:            no      (--with-ngtcp2, --with-quiche)
  ECH:              no      (--enable-ech)
  Protocols:        DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS MQTT POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP
  Features:         AsynchDNS HTTPS-proxy IPv6 NTLM NTLM_WB SSL TLS-SRP UnixSockets

您可能缺少 zlib 和 openssl 库的动态版本。 为 ARM 构建动态 curl 可执行文件的许多可能过程之一可能是:

CROSS_COMPILE=/opt/arm/9/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-
PREFIX=$(pwd)/sysroot

wget https://www.openssl.org/source/openssl-1.1.1h.tar.gz
tar zxf openssl-1.1.1h.tar.gz
pushd openssl-1.1.1h
./Configure linux-generic32 shared  -DL_ENDIAN --prefix=${PREFIX} --openssldir=${PREFIX} shared
make CROSS_COMPILE=/opt/arm/9/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf- PROCESSOR=ARM install
popd

wget https://zlib.net/zlib-1.2.11.tar.gz
tar xvf zlib-1.2.11.tar.gz
pushd zlib-1.2.11
CC=${CROSS_COMPILE}gcc ./configure --prefix=${PREFIX}
make CC=${CROSS_COMPILE}gcc all install 
popd

wget https://curl.haxx.se/download/curl-7.73.0.tar.gz
tar zxf curl-7.73.0.tar.gz
pushd curl-7.73.0
CC=${CROSS_COMPILE}gcc LD=${CROSS_COMPILE}ld AR=${CROSS_COMPILE}ar NM=${CROSS_COMPILE}nm AS=${CROSS_COMPILE}as  ./configure --disable-static --enable-shared --with-ssl=${PREFIX} --prefix=${PREFIX} --host=arm-none-linux-gnueabihf --target=arm-none-linux-gnueabihf --without-libidn2
make CC=${CROSS_COMPILE}gcc LD=${CROSS_COMPILE}ld AR=${CROSS_COMPILE}ar NM=${CROSS_COMPILE}nm AS=${CROSS_COMPILE}as install
popd


ll -gG sysroot/lib/
total 6796
drwxrwxr-x 4    4096 Nov 16 08:10 ./
drwxrwxr-x 9    4096 Nov 16 07:53 ../
drwxrwxr-x 2    4096 Nov 16 07:53 engines-1.1/
-rw-r--r-- 1 3199974 Nov 16 07:53 libcrypto.a
lrwxrwxrwx 1      16 Nov 16 07:53 libcrypto.so -> libcrypto.so.1.1*
-rwxr-xr-x 1 2087864 Nov 16 07:53 libcrypto.so.1.1*
-rwxr-xr-x 1    1027 Nov 16 08:10 libcurl.la*
lrwxrwxrwx 1      16 Nov 16 08:10 libcurl.so -> libcurl.so.4.7.0*
lrwxrwxrwx 1      16 Nov 16 08:10 libcurl.so.4 -> libcurl.so.4.7.0*
-rwxr-xr-x 1  407748 Nov 16 08:10 libcurl.so.4.7.0*
-rw-r--r-- 1  578076 Nov 16 07:53 libssl.a
lrwxrwxrwx 1      13 Nov 16 07:53 libssl.so -> libssl.so.1.1*
-rwxr-xr-x 1  453684 Nov 16 07:53 libssl.so.1.1*
-rw-r--r-- 1   96210 Nov 16 07:51 libz.a
lrwxrwxrwx 1      14 Nov 16 07:51 libz.so -> libz.so.1.2.11*
lrwxrwxrwx 1      14 Nov 16 07:51 libz.so.1 -> libz.so.1.2.11*
-rwxr-xr-x 1   98708 Nov 16 07:51 libz.so.1.2.11*
drwxrwxr-x 2    4096 Nov 16 08:10 pkgconfig/

file sysroot/bin/curl
sysroot/bin/curl: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, with debug_info, not stripped