curl / Mailing Lists / curl-library / Single Mail

curl-library

Build libcurl using mingw32 with static openssl

From: Thomas Glanzmann <thomas_at_glanzmann.de>
Date: Wed, 29 Mar 2017 18:11:37 +0200

Hello,
I try to compile libcurl using mingw32 and a static linked openssl. It
worked in the past, however at the moment I'm unable to do so. The
reason seems to be:

...
configure:21627: result: no
configure:21655: PKG_CONFIG_LIBDIR will be set to "/home/sithglan/work/vlconnect/curl/../local/win32/openssl/lib/pkgconfig"
configure:21679: checking for mingw32-pkg-config
configure:21713: result: no
configure:21723: checking for pkg-config
configure:21742: found /usr/bin/pkg-config
configure:21754: result: /usr/bin/pkg-config
configure:21779: checking for openssl options with pkg-config
configure:21793: result: found
configure:21822: pkg-config: SSL_LIBS: "-lssl -lcrypto -lgdi32 "
configure:21824: pkg-config: SSL_LDFLAGS: "-L/home/sithglan/work/vlconnect/openssl/../local/win32/openssl/lib "
configure:21826: pkg-config: SSL_CPPFLAGS: "-I/home/sithglan/work/vlconnect/openssl/../local/win32/openssl/include "
configure:21838: checking for HMAC_Update in -lcrypto
configure:21860: gcc -o conftest -Os -Wno-system-headers -I/home/sithglan/work/vlconnect/openssl/../local/win32/openssl/include -L/home/sithglan/work/vlconnect/openssl/../local/win32/openssl/lib conftest.c -lcrypto -lssl -lcrypto -lgdi32 >&5
/usr/bin/ld: skipping incompatible /home/sithglan/work/vlconnect/openssl/../local/win32/openssl/lib/libcrypto.a when searching for -lcrypto
/usr/bin/ld: skipping incompatible /home/sithglan/work/vlconnect/openssl/../local/win32/openssl/lib/libssl.a when searching for -lssl
/usr/bin/ld: skipping incompatible /home/sithglan/work/vlconnect/openssl/../local/win32/openssl/lib/libcrypto.a when searching for -lcrypto
/usr/bin/ld: cannot find -lgdi32
collect2: error: ld returned 1 exit status
configure:21860: $? = 1
configure: failed program was:
...

Has someone a workaround for this?

I'm building on a 64 bit debian stable from git HEAD of openssl and curl
using:

--
#!/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 COMMON_PARAMETERS="--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"
set -e
build_openssl()
{
(
        cd openssl
        git reset --hard HEAD; git clean -f -x -d
        # no-shared no-asm no-ssl3 no-comp no-idea no-dtls no-hw no-dso no-err no-psk no-srp no-ec2m -DOPENSSL_NO_HEARTBEATS
        CC=/usr/bin/i686-w64-mingw32-gcc ./Configure --prefix=`pwd`/../local/win32/openssl mingw no-shared
        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/ if /^Libs:/' `pwd`/../local/win32/openssl/lib/pkgconfig/libcrypto.pc
)
}
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 \
                $COMMON_PARAMETERS
        make -j
        make install
)
}
rm -rf local
build_openssl
build_curl_openssl
--
Cheers,
        Thomas
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2017-03-29