curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Build libcurl using mingw32 with static openssl

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Wed, 29 Mar 2017 16:20:40 -0400

On 3/29/2017 12:11 PM, Thomas Glanzmann wrote:
> 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

architecture mismatch maybe? the gdi thing I've seen before I think it
has to do with -ldl missing when openssl is static? libcurl configure
script doesn't really account for static dependencies, afaik it relies
on the pkgconfig to give what's needed

I cross compiled static openssl in ubuntu though and I didn't have a
problem, here is exactly how I did it:

sudo apt-get install mingw-w64 mingw-w64-common mingw-w64-i686-dev
mingw-w64-tools mingw-w64-x86-64-dev
curl --fail --location --remote-name-all \
     https://www.openssl.org/source/openssl-1.0.2k.tar.gz \
     https://www.openssl.org/source/openssl-1.0.2k.tar.gz.asc \
     https://curl.haxx.se/download/curl-7.53.1.tar.gz \
     https://curl.haxx.se/download/curl-7.53.1.tar.gz.asc
gpg --verify openssl-1.0.2k.tar.gz.asc
gpg --verify curl-7.53.1.tar.gz.asc
mkdir cross-compile
cd cross-compile
tar xfz ../openssl-1.0.2k.tar.gz
tar xfz ../curl-7.53.1.tar.gz
cd openssl-1.0.2k/
export CROSS_COMPILE="x86_64-w64-mingw32-"
./Configure mingw64 no-asm no-shared --openssldir=$PWD/../mingw64/ssl
make depend
make
make install
cd ../curl-7.53.1/
./configure --host=x86_64-w64-mingw32 --disable-shared --disable-ldap
--without-librtmp --with-ssl=$PWD/../mingw64/ssl
--prefix=$PWD/../mingw64/curl
make
make install

That should put a standalone 64-bit curl.exe in mingw64/curl/bin
curl 7.53.1 (x86_64-w64-mingw32) libcurl/7.53.1 OpenSSL/1.0.2k
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s
rtsp smb smbs smtp smtps telnet tftp
Features: IPv6 Largefile NTLM SSL TLS-SRP HTTPS-proxy

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-03-29