curl-library
Re: Build libcurl using mingw32 with static openssl
From: Thomas Glanzmann <thomas_at_glanzmann.de>
Date: Thu, 30 Mar 2017 11:06:01 +0200
Date: Thu, 30 Mar 2017 11:06:01 +0200
Hello Ray,
thank you for your build instructions. In the ouptut there was clearly
something really wrong because I ran gcc to link the mingw target which
can't work. But now it works and I had to add on more library:
-lcrypt32. I'm building against openssl 1.1.0 pre 6. Below, find my
build instructions in case someone has the same issue.
--
#!/bin/bash
# apt-get install git make gcc libx11-dev mingw-w64 libtool
export PATH=/usr/lib/ccache:$PATH
export CFLAGS='-Os'
# --enable-werror
export LIBCURL_COMMON_PARAMS="--enable-ipv6 \
--enable-sspi \
--disable-ares \
--disable-cookies \
--disable-manual \
--disable-versioned-symbols \
--disable-hidden-symbols \
--disable-shared \
--disable-manual \
--disable-libcurl-option \
--disable-ftp \
--disable-smb \
--disable-dict \
--disable-file \
--disable-gopher \
--disable-imap \
--disable-imaps \
--disable-pop3 \
--disable-pop3s \
--disable-ldap \
--disable-ldaps \
--disable-rtsp \
--disable-telnet \
--disable-tftp \
--disable-smtp \
--disable-smtps \
--with-gssapi \
--without-libidn \
--without-librtmp \
--without-libssh2 \
--without-gssapi \
--disable-unix-sockets \
--without-ca-bundle \
--without-zlib"
export OPENSSL_COMMON_PARAMS="no-shared no-asm no-ssl3 no-comp no-idea no-dtls no-hw no-dso no-err no-psk no-srp no-ec2m no-weak-ssl-ciphers -DOPENSSL_NO_HEARTBEATS"
set -e
build_mbedtls()
{
(
cd mbedtls
git reset --hard HEAD; git clean -f -x -d
CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS="$CFLAGS" WINDOWS=1 make -j lib
make DESTDIR=`pwd`/../local/win32/mbedtls install
git reset --hard HEAD; git clean -f -x -d
CFLAGS="$CFLAGS" make -j lib
make DESTDIR=`pwd`/../local/linux/mbedtls install
)
}
build_openssl()
{
(
cd openssl
git reset --hard HEAD; git clean -f -x -d
CC=/usr/bin/i686-w64-mingw32-gcc ./Configure --prefix=`pwd`/../local/win32/openssl mingw ${OPENSSL_COMMON_PARAMS}
perl -p -i -e 's/-O3/-Os/ if /^CFLAG/' Makefile
perl -p -i -e 's/-march=i486 // if /^CFLAG/' Makefile
make depend
make -j 8
make install_sw
perl -p -i -e 's/$/ -lgdi32 -lcrypt32/ if /^Libs:/' `pwd`/../local/win32/openssl/lib/pkgconfig/libcrypto.pc
git reset --hard HEAD; git clean -f -x -d
./Configure --prefix=`pwd`/../local/linux/openssl linux-x86_64 ${OPENSSL_COMMON_PARAMS}
perl -p -i -e 's/-O3/-Os/ if /^CFLAG/' Makefile
perl -p -i -e 's/-march=i486 // if /^CFLAG/' Makefile
make depend
make -j 8
make install_sw
perl -p -i -e 's/$/ -ldl -lpthread/ if /^Libs:/' `pwd`/../local/linux/openssl/lib/pkgconfig/libcrypto.pc
)
}
build_wolfssl()
{
(
cd wolfssl
git reset --hard HEAD; git clean -f -x -d
./autogen.sh
C_EXTRA_FLAGS="\
-Wno-attributes \
-Wno-unused-but-set-variable \
-DFP_MAX_BITS=16384 \
-DTFM_TIMING_RESISTANT \
-DWOLFSSL_STATIC_DH \
-DWOLFSSL_STATIC_RSA \
" \
./configure --prefix=`pwd`/../local/linux/wolfssl \
--disable-jobserver \
--enable-sni \
--enable-static \
--enable-shared=no \
# --enable-aesgcm \
# --enable-alpn \
# --enable-certgen \
# --enable-des3 \
# --enable-dh \
# --enable-dsa \
# --enable-ecc \
# --enable-eccshamir \
# --enable-fastmath \
# --enable-opensslextra \
# --enable-ripemd \
# --enable-sessioncerts \
# --enable-sha512 \
# --enable-sslv3 \
# --enable-supportedcurves \
# --enable-testcert \
make
make install
)
}
build_curl_mbedtls()
{
(
cd curl
git reset --hard HEAD; git clean -f -x -d
./buildconf
CC=i686-w64-mingw32-gcc ./configure CFLAGS="${CFLAGS}" \
--without-ssl --with-mbedtls=`pwd`/../local/win32/mbedtls \
--host=mingw32 \
--prefix=`pwd`/../local/win32/mbedtls \
$LIBCURL_COMMON_PARAMS
make -j
make install
git reset --hard HEAD; git clean -f -x -d
./buildconf
./configure CFLAGS="${CFLAGS}"\
--without-ssl --with-mbedtls=`pwd`/../local/linux/mbedtls \
--prefix=`pwd`/../local/linux/mbedtls \
$LIBCURL_COMMON_PARAMS
make -j
make install
)
}
build_curl_winssl()
{
(
cd curl
git reset --hard HEAD; git clean -f -x -d
./buildconf
CC=i686-w64-mingw32-gcc ./configure CFLAGS="${CFLAGS}" \
--without-ssl --with-winssl \
--host=mingw32 \
--prefix=`pwd`/../local/win32/winssl \
$LIBCURL_COMMON_PARAMS
make -j
make install
)
}
build_curl_openssl()
{
(
cd curl
git reset --hard HEAD; git clean -f -x -d
./buildconf
CC=i686-w64-mingw32-gcc ./configure CFLAGS="${CFLAGS}" \
--with-ssl=`pwd`/../local/win32/openssl \
--host=mingw32 \
--prefix=`pwd`/../local/win32/openssl \
$LIBCURL_COMMON_PARAMS
make -j
make install
git reset --hard HEAD; git clean -f -x -d
./buildconf
./configure CFLAGS="${CFLAGS}" \
--with-ssl=`pwd`/../local/linux/openssl \
--prefix=`pwd`/../local/linux/openssl \
$LIBCURL_COMMON_PARAMS
make -j
make install
)
}
build_curl_wolfssl()
{
(
cd curl
# git reset --hard HEAD; git clean -f -x -d
# ./buildconf
# CC=i686-w64-mingw32-gcc ./configure CFLAGS="${CFLAGS}" \
# --with-ssl=`pwd`/../local/win32/openssl \
# --host=mingw32 \
# --prefix=`pwd`/../local/win32/openssl \
# $LIBCURL_COMMON_PARAMS
# make -j
# make install
git reset --hard HEAD; git clean -f -x -d
./buildconf
./configure CFLAGS="${CFLAGS}" \
--without-ssl --with-cyassl=`pwd`/../local/linux/wolfssl \
--prefix=`pwd`/../local/linux/wolfssl \
$LIBCURL_COMMON_PARAMS
make -j
make install
)
}
rm -rf local
build_wolfssl
build_openssl
build_mbedtls
build_curl_mbedtls
build_curl_winssl
build_curl_openssl
build_curl_wolfssl
--
Cheers,
Thomas
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-03-30