2017-01-22 146 views
2

我试图从Linux(Debian Jessie)为Windows交叉编译。我编译了zlibOpenSSL,并且cURL的配置脚本确实找到了这些库,但仍然表示SSL支持已关闭。不能交叉编译cURL与Windows的OpenSSL支持

这是构建脚本我用:

# ZLIB 
cd /builds 
curl -O -J http://www.zlib.net/zlib-1.2.11.tar.gz 
tar xf zlib-1.2.11.tar.gz 
cd /builds/zlib-1.2.11 
CC=x86_64-w64-mingw32-gcc ./configure --prefix=/usr/x86_64-w64-mingw32 --static 
make && make install 

# OPENSSL 
cd /builds 
curl -O -J https://www.openssl.org/source/openssl-1.1.0c.tar.gz 
tar xf openssl-1.1.0c.tar.gz 
cd /builds/openssl-1.1.0c 
CROSS_COMPILE="x86_64-w64-mingw32-" ./Configure -DHAVE_STRUCT_TIMESPEC -lz -lws2_32 zlib mingw64 no-shared --prefix=/usr/x86_64-w64-mingw32 
make depend 
make && make install 

# CURL 
cd /builds 
curl -O -J https://curl.haxx.se/download/curl-7.52.1.tar.gz 
cd /builds/curl-7.52.1 
./configure --prefix=/usr/x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --enable-optimize --with-ssl=/usr/x86_64-w64-mingw32 

它发现库成功,但随后SSL刚禁用,因为缺少--with-ssl

checking whether to enable Windows native SSL/TLS (Windows native builds only)... no 
checking whether to enable Apple OS native SSL/TLS... no 
checking for gdi32... yes 
configure: PKG_CONFIG_LIBDIR will be set to "/usr/x86_64-w64-mingw32/lib/pkgconfig" 
checking for x86_64-w64-mingw32-pkg-config... /usr/bin/pkg-config 
checking for openssl options with pkg-config... found 
configure: pkg-config: SSL_LIBS: "-lssl -lcrypto " 
configure: pkg-config: SSL_LDFLAGS: "-L/usr/x86_64-w64-mingw32/lib " 
configure: pkg-config: SSL_CPPFLAGS: "-I/usr/x86_64-w64-mingw32/include " 
checking for HMAC_Update in -lcrypto... no 
checking for HMAC_Init_ex 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 
checking whether to use builtin CA store of SSL library... no 

全部日志:https://paste.kde.org/pwzewydif

回答

1

要用ssl支持交叉编译curl,我直接在CPP_FLAGSLD_FLAGS提供位置,而不是pro viding路径与--with-ssl

export DESTDIR="$CURL_INSTALL_DIR" 
export CPPFLAGS="-I${OPENSSL_INSTALL_DIR}/include -I${ZLIB_INSTALL_DIR}/include" 
export LDFLAGS="-L${OPENSSL_INSTALL_DIR}/lib -L${ZLIB_INSTALL_DIR}/lib" 
export LIBS="-lssl -lcrypto" 

CURL_ARGS="--with-ssl --with-zlib --disable-ftp --disable-gopher 
    --disable-file --disable-imap --disable-ldap --disable-ldaps 
    --disable-pop3 --disable-proxy --disable-rtsp --disable-smtp 
    --disable-telnet --disable-tftp --without-gnutls --without-libidn 
    --without-librtmp --disable-dict" 

chmod 777 buildconf 
./buildconf 
./configure --host="${CROSS_COMPILE}" $CURL_ARGS 

make -j16 
make install 

入住这curl cross compilation script

+0

它没有工作,但是我发现我可以建立卷曲7.49 *而不是> = 7.50 *。这可能是配置脚本的错误,我会将其报告给作者。还是要谢谢你的帮助。 –

+0

很高兴它与7.49一起工作,但我没有任何问题来构建7.50。*(我测试过7.50.0)也许问题在别的地方 –

+0

那么最新的7.52.1呢?你在为哪个平台建设? (顺便说一句,不幸的是,我得到了一些“未定义的引用”cURL本身,同时建立...我会重建码头图像给它另一个尝试...) –