curl / Mailing Lists / curl-library / Single Mail


How to compile libcurl.dll with GnuTLS integrated?

From: Reino Wijnsma <>
Date: Sun, 6 Aug 2017 22:46:29 +0200

Hello libcurl users/developers,

Recently I've forked Roger's ffmpeg-windows-build-helpers
<> to compile a
FFmpeg build that's compatible with my old system. This was my first
time dealing with Bash, Cygwin, GCC and other Linux stuff. It took a lot
of time and effort, but it proved to be successful in the end.
Now I've been using the same script to cross-compile libcurl with
GnuTLS. The original unused function so far

With the following updated function I've successfully compiled an all
static '/curl.exe/', using statically built dependencies (gmp, nettle,
gnutls and zlib):

build_libcurl() {
  cd curl-7.54.1
    export PKG_CONFIG="pkg-config --static"
    generic_configure "--without-ssl --with-gnutls --without-ca-bundle
    unset PKG_CONFIG
  cd ..

curl 7.54.1 (i686-w64-mingw32) libcurl/7.54.1 GnuTLS/3.5.14 zlib/1.2.11
Release-Date: 2017-06-14
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps
pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: IPv6 Largefile NTLM SSL libz TLS-SRP HTTPS-proxy

Now since I was used to the fact that FFmpeg has no problems using
statically built libraries to compile a shared FFmpeg build
('/avcodec-57.dll/', '/av//format//-57.dll/', etc.), I thought I could
do the same for libcurl:

build_libcurl() {
  cd curl-7.54.1
    export PKG_CONFIG="pkg-config --static"
    do_configure "--host=$host_target --prefix=$mingw_w64_x86_64_prefix
*--disable-static* --without-ssl --with-gnutls --without-ca-bundle
    unset PKG_CONFIG
  cd ..

But this turned out to be a bit different:

  CC vtls/libcurl_la-gskit.lo
  CC vtls/libcurl_la-mbedtls.lo

*** Warning: This system cannot link to static lib archive /cygdrive/m/ffm
*** I have the capability to make that library automatically link in when
*** you link to this library. But I can only do this if you have a
*** shared version of the library, which you do not appear to have.

*** Warning: [...]/

*** Warning: linker path does not have real file for library -lhogweed.

*** Warning: linker path does not have real file for library -lnettle.

*** Warning: linker path does not have real file for library -lz.
*** The inter-library dependencies that have been dropped here will be
*** automatically added whenever a program is linked with this library
*** or is declared to -dlopen it.

*** Since this library must not contain undefined symbols,
*** because either the platform does not support them or
*** it was explicitly requested with -no-undefined,
*** libtool will only create a static version of it.


  CC ../lib/curl-nonblock.o
  CC ../lib/curl-warnless.o
  CCLD curl.exe
curl-slist_wc.o:slist_wc.c:(.text+0x20): undefined reference to
curl-slist_wc.o:slist_wc.c:(.text+0x7d): undefined reference to
curl-slist_wc.o:slist_wc.c:(.text+0xa3): undefined reference to
curl-tool_cb_dbg.o:tool_cb_dbg.c:(.text+0x97): undefined reference to
curl-tool_cb_dbg.o:tool_cb_dbg.c:(.text+0x171): undefined reference to

I've also tried export LDFLAGS="-static". This made the above mentioned
warnings go away, but all the 'undefined reference'-errors remained.
*Is it possible at all to compile libcurl using statically built

Next I've tried building the dependencies shared. This worked for gmp
('/libgmp-10.dll/'), nettle ('/libnettle-6.dll/' and
'/libhogweed-4.dll/') and gnutls ('/libgnutls-30.dll/'), but no matter
what I couldn't get zlib to compile a shared library, so I had to add
--without-zlib to GnuTLS- and libcurl's configure-line.
This proved successful, but not in the way I expected. The resulting
'/libcurl.dll/' still relies on the previously mentioned dependency
dlls. I was expecting a '/libcurl.dll/' that would have all dependencies
*I've looked through all the available libcurl configure-options, but is
it possible **at all to compile a 'libcurl.dll'**like that?*

With kind regards,

Received on 2017-08-06