"Jesse Nicholson" <[email protected]> wrote:

Anyway so I downloaded latest release c-ares, zlib and curl... compiled
c-ares successfully (although I can only get it to spit out a static lib),

That's the problem.

zlib compiled without issue, then on to curl. Curl will compile the static
lib without issue, but as soon as it goes to link together libcurl.dll, I
get a ton of undefined references to c-ares functions. (note that the
linker doesn't complain about not finding -lcares) Example:

Then I guess you *don't* have both of these files:

dir g:\MingW32\src\inet\DNS\c-ares\*.a

3.10.2012  16:21         424.734  libcares.a
3.10.2012  16:21          58.172  libcares.dll.a

Per the gcc heuristics when given a command like "-lcares" it
will pick "libcares.dll.a" first, then "libcares.a" (if the first
imp-lib isn't found). That's my I prefer to use absolute lib names.

In this case Makefile.m32 should IMHO have stated:
 DLL_LIBS += "$(LIBCARES_PATH)/libcares.dll.a"  (absolute form)
and not:
 DLL_LIBS += -L"$(LIBCARES_PATH)" -lcares     (obfuscated form)


That's why `_imp__ares_version` is missing (since ld sees a static
lib). Check it by modifying the link command to produce a .map-file:

$(libcurl_dll_LIBRARY): $(libcurl_a_OBJECTS) $(RESOURCE) 
$(libcurl_dll_DEPENDENCIES)
@$(call DEL, $@)
$(CC) -v -Wl,--print-map,--sort-common,--cref $(LDFLAGS) -shared -o $@ \
  -Wl,--output-def,$(@:.dll=.def),--out-implib,$(libcurl_dll_a_LIBRARY) \
  $(libcurl_a_OBJECTS) $(RESOURCE) $(DLL_LIBS) > $(@:.dll=.map)

If you have only libcares.a you will see something like:
 LOAD g:\MingW32\src\inet\DNS\C-ares/libcares.a

If you have both libcares.a and libcares.dll.a you will see something like:
 LOAD g:\MingW32\src\inet\DNS\C-ares/libcares.dll.a

BTW. Why is $(libcurl_dll_DEPENDENCIES) == libcares.a here?

If you reall want to use libcares.a (static lib), add '-DCARES_STATICLIB' to
your CFLAGS. But it would be best to figure out why libcares.dll.a isn't
produced.

--gv
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to