Re: Minimal libcurl compile for windows
Date: Thu, 7 May 2020 12:44:10 +0000
That is interesting, I'll try the nmake command with additional flags today.
But for what it's worth, I've managed to bring down the unresolved
externals just to 1.
libcurl.a(strerror.o) : error LNK2019: unresolved external symbol
__imp__sys_nerr referenced in function Curl_strerror
The others have been fixed by adding:
#pragma comment (lib, "legacy_stdio_definitions.lib")
#pragma comment (lib, "lib/libgcc.a")
and I followed this little guide:
https://gmplib.org/list-archives/gmp-discuss/2006-July/002415.html
I just used grep for the symbol that was missing for me.
Therefore I found that I need libgcc.a and moved it into the lib directory
for my project.
Unfortunately I can't find any related files for "strerror.o" or
"__imp__sys_nerr"
Do you have an idea if there are any flags I could use, which I already
haven't, that would disable this functionality,
or perhaps if there is another way to remove the last error?
On Thu, May 7, 2020 at 4:09 AM Ray Satiro via curl-library <
curl-library_at_cool.haxx.se> wrote:
> 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
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-05-07