我试图用SSL交叉编译Curl,但我无法做到。
以下是我为OpenSSL所做的事情:
CROSS=arm-linux-gnuabi
./Configure linux-generic32 shared --prefix=/home --openssldir=/home
make CC="${CROSS}-gcc" AR="${CROSS}-ar r" RANLIB="${CROSS}-ranlib" LD="${CROSS}-ld" MAKEDEPPROG="${CROSS}-gcc" PROCESSOR=ARM
make CC="${CROSS}-gcc" AR="${CROSS}-ar r" RANLIB="${CROSS}-ranlib" INSTALL_PREFIX=/home/lz/sysroot install
结果,在/ home / lz / sysroot / home中,我得到了:
drwxrwxr-x 2 lz lz 4.0K Feb 25 08:14 bin
drwxrwxr-x 2 lz lz 4.0K Feb 25 08:04 certs
drwxrwxr-x 3 lz lz 4.0K Feb 25 08:16 include
drwxrwxr-x 4 lz lz 4.0K Feb 25 08:16 lib
drwxrwxr-x 6 lz lz 4.0K Feb 25 08:03 man
drwxrwxr-x 2 lz lz 4.0K Feb 25 08:14 misc
-rw-r--r-- 1 lz lz 11K Feb 25 08:14 openssl.cnf
drwxrwxr-x 2 lz lz 4.0K Feb 25 08:04 private
drwxrwxr-x 5 lz lz 4.0K Feb 25 08:05 share
[20150225 08:18:26] lz@lz:~/sysroot$ ls -lh home/lib/
total 6.1M
drwxrwxr-x 2 lz lz 4.0K Feb 25 08:14 engines
-rw-r--r-- 1 lz lz 3.1M Feb 25 08:14 libcrypto.a
lrwxrwxrwx 1 lz lz 18 Feb 25 08:14 libcrypto.so -> libcrypto.so.1.0.0
-rwxr-xr-x 1 lz lz 2.0M Feb 25 08:14 libcrypto.so.1.0.0
-rw-r--r-- 1 lz lz 574K Feb 25 08:14 libssl.a
lrwxrwxrwx 1 lz lz 15 Feb 25 08:14 libssl.so -> libssl.so.1.0.0
-rwxr-xr-x 1 lz lz 442K Feb 25 08:14 libssl.so.1.0.0
drwxrwxr-x 2 lz lz 4.0K Feb 25 08:04 pkgconfig
[20150225 08:20:35] lz@lz:~/sysroot$ ls -lh home/include/openssl/ | grep "\(ssl\|crypto\)"
-rw-r--r-- 1 lz lz 28K Feb 25 08:14 crypto.h
-rw-r--r-- 1 lz lz 6.8K Feb 25 08:14 kssl.h
-rw-r--r-- 1 lz lz 6.8K Feb 25 08:14 opensslconf.h
-rw-r--r-- 1 lz lz 3.9K Feb 25 08:14 opensslv.h
-rw-r--r-- 1 lz lz 7.7K Feb 25 08:14 ossl_typ.h
-rw-r--r-- 1 lz lz 3.8K Feb 25 08:14 ssl23.h
-rw-r--r-- 1 lz lz 12K Feb 25 08:14 ssl2.h
-rw-r--r-- 1 lz lz 33K Feb 25 08:14 ssl3.h
-rw-r--r-- 1 lz lz 146K Feb 25 08:14 ssl.h
但是当我尝试使用SSL支持构建Curl时,我无法使其工作,我尝试了以下内容:
./configure --with-ssl --with-sysroot=/home/lz/sysroot --prefix=/home --host=${CROSS}
./configure --with-ssl --with-sysroot=/home/lz/sysroot/home --host=${CROSS}
./configure --with-ssl --prefix=/home/lz/sysroot/home --host=${CROSS}
./configure --with-ssl=/home/lz/sysroot/home --with-sysroot=/home/lz/sysroot --prefix=/home --host=${CROSS}
我总是得到这个警告:
checking whether to enable Windows native SSL/TLS (Windows native builds only)... no
checking whether to enable iOS/Mac OS X native SSL/TLS... no
checking for CRYPTO_lock in -lcrypto... no
checking for CRYPTO_add_lock in -lcrypto... no
checking for ssl_version in -laxtls... no
configure: WARNING: SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.
configure: WARNING: Use --with-ssl, --with-gnutls, --with-polarssl, --with-cyassl, --with-nss, --with-axtls, --with-winssl, or --with-darwinssl to address this.
checking default CA cert bundle/path... configure: WARNING: skipped the ca-cert path detection when cross-compiling
no
最后,SSL支持未激活:
configure: Configured to build curl/libcurl:
curl version: 7.38.1-20141105
Host setup: arm-linux-gnuabi
Install prefix: /home
Compiler: arm-linux-gnuabi-gcc
SSL support: no (--with-{ssl,gnutls,nss,polarssl,cyassl,axtls,winssl,darwinssl} )
SSH support: no (--with-libssh2)
zlib support: no (--with-zlib)
GSS-API support: no (--with-gssapi)
TLS-SRP support: no (--enable-tls-srp)
resolver: default (--enable-ares / --enable-threaded-resolver)
ipv6 support: no (--enable-ipv6)
IDN support: no (--with-{libidn,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
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)
HTTP2 support: disabled (--with-nghttp2)
Protocols: DICT FILE FTP GOPHER HTTP IMAP POP3 RTSP SMTP TELNET TFTP
我无法理解遗漏的内容,而且我找到Curl实际上在寻找OpenSSL目录的地方还不够详细。
感谢您的帮助。