2017-01-22 145 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本身,同時建立...我會重建碼頭圖像給它另一個嘗試...) –