curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Problem linking statically libcurl

From: Jeroen Ooms <jeroenooms_at_gmail.com>
Date: Fri, 11 May 2018 11:55:02 +0200

On Thu, May 10, 2018 at 7:56 PM, f1sher_at_gmx.com <f1sher_at_gmx.com> wrote:
> Hello !
>
> I'm not sure if it's the right place to ask, don't hesitate to redirect me
> ;)
>
> I've been trying for several weeks now to compile libcurl statically using
> mingw-w64-gcc on arch linux, I successfully linked libcurl, libssl,
> libcrypto, libssh2, libz and libidn2 statically (I can now run my exe
> without the corresponding DLL's), but when i try to link the last needed
> library statically, libunistring, I get the following errors :
>
> undefined reference to `__imp_uninorm_nfc'
>
> undefined reference to `__imp_UC_CATEGORY_M'
>
> Seems like a lib is missing, but I can't find wich one.
>
> I use the following LDLIBS in my makefile :
>
> LDLIBS = -l:libcurl.a -l:libssl.a -l:libcrypto.a -l:libssh2.a -l:libz.a
> -l:libidn2.a -l:libunistring.a -lws2_32 -lgdi32 -lwldap32 -liconv
>
> (When I replace -l:libunistring.a by -lunistring, the error disappears, and
> libunistring-2.dll is needed again).
>
> Do you have any idea how I can fix it ?

Make sure you compile the appliation that you want to link against
libcurl using this cflag:

  -DCURL_STATICLIB

Otherwise you can only dynamically link. After that I always link with:

  -lcurl -lssh2 -lz -lssl -lcrypto -lgdi32 -lws2_32 -lcrypt32 -lwldap32
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2018-05-11