Kan ikke krydskompilere cURL med OpenSSL-understøttelse til Windows

Indlæg af Hanne Mølgaard Plasc

Problem



Jeg forsøger at krydssammenlægge fra Linux (Debian Jessie) til Windows. Jeg har lavet zlib og OpenSSL og konfigurationsskriptet til cURL fandt bibliotekerne, men det sagde stadig, at SSL-support var slukket.


Dette er det build script, jeg brugte:


# 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


Det fandt biblioteket succesfuldt, men så blev SSL lige blevet deaktiveret på grund af manglende --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


Fuld log: https://paste.kde.org/pwzewydif[10]

Bedste reference


For at krydse kompilere curl med ssl support gav jeg placeringen direkte i CPP\_FLAGS og LD\_FLAGS i stedet for at give stien med --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


Tjek dette curl cross compilation script [11]