curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Minimal libcurl compile for windows

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Thu, 7 May 2020 00:02:49 -0400

On 5/6/2020 3:25 PM, Testing WunTuTri via curl-library wrote:
>
>
> I did this
>
> Compiling the static lib on windows with nmake yields libcurl_a.lib
> and a bunch of obj files,
>
> libcurl_a.lib needs to be in the folder with the obj files in order
> for my program to compile without unresolved externals.
>
> Which is GREAT! But,
>
> I can't seem to disable certain curl features using nmake, the same
> way I can do with
> ./configure && make && make install
>
> |./configure --disable-ares --disable-cookies --disable-crypto-auth
> --disable-ipv6 --disable-manual --disable-proxy --disable-verbose
> --disable-versioned-symbols --enable-hidden-symbols --without-libidn
> --without-librtmp --without-ssl --without-zlib --disable-dict
> --disable-file --disable-ftp --disable-gopher --disable-imap
> --disable-ldap --disable-ldaps --disable-pop3 --disable-rtsp
> --disable-smtp --disable-telnet --disable-tftp --disable-pthread
> --prefix=/curl|
>
> This is the configure command I use on git-bash sdk on the same
> windows VM where I used nmake. Everything compiles without erros
> except the fact that all I get is the libcurl.a library instead of
> libcurl_a.lib.
>
> Using it in my program (x64/windows; http-get request to read string
> from given host)
>
> `
> #include "curl/curl.h"
>
> #pragma comment (lib, "crypt32.lib")
>
> #pragma comment (lib, "advapi32")
>
> #pragma comment (lib, "ws2_32.lib")
>
> #pragma comment (lib, "wldap32.lib")
>
> #pragma comment (lib, "normaliz.lib")
>
> #pragma comment (lib, "libcurl/libcurl.a")
> `
>
> gives me 6 unresolved externals.
>
> https://pastebin.com/raw/fFPVHZGR
>
>
> I tried linking all the .o files to libcurl.a when compiling, with no
> luck.
>
>
> I expected the following
>
> |make install| to produce the libcurl_a.lib file
>
>
> curl/libcurl version
>
> 7.70.0
>
> I have been looking everywhere and I've spend nearly 10 hours today
> trying to get this sorted, what am I possibly doing wrong?
>

If you are not building the library with the Microsoft compiler, as you
would with winbuild and nmake, then you end up with an .a file. It looks
as though you are attempting to build your application using the
Microsoft compiler and linking to that .a file. AFAIK that is not
guaranteed to work. Likely the errors you are seeing is a result of CRT
mismatch. MinGW is using one CRT and Visual Studio or whatever expects
another. Even if you use the same CRT I don't think it is supported to
mix static libraries that way, but I'm not certain. My advice pick one
compiler or the other.

If you need to use MS compiler to build your app and need static
libcurl.lib and want to disable features with the winbuild method, you
could probably do that by finding the defines and specifying them on the
command line.

nmake /E CC="cl /DCURL_DISABLE_COOKIES /DCURL_DISABLE_DICT
/DCURL_DISABLE_FILE /DCURL_DISABLE_FTP /DCURL_DISABLE_LDAP
/DCURL_DISABLE_LDAPS /DCURL_DISABLE_TELNET /DCURL_DISABLE_TFTP "

and so on

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-05-07