cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: BUG - Build fails at gethostbyname() check

From: Michael James <james.me_at_gmail.com>
Date: Fri, 6 Jun 2008 00:37:15 -0700

On Thu, 5 Jun 2008, Daniel Stenberg wrote:

>
> Thanks for report!
>
>> This is a bug introduced in the 7.18.2 build, everything worked fine
>> in 7.18.1 and earlier.
>
> I take it you mean on Windows using MSYS? Any particular Windows version?

My configuration is probably atypical:

Using the Cygwin environment with the MSVC compiler. It is obvious
that the configure script was not set up for this as it passes $CC a
lot of gcc style compiler options to MS's cl.exe. Fortunately cl is
polite enough to print a diagnostic that it doesn't recognize the
option and proceed anyway. That said, this has worked successfully for
me in the past and I use it in preference to the nmake file you
provide because it lets me disable parts of curl that I don't want to
build. (Maybe nmake can do that also, but I am not very familiar with
that tool.)

# This has worked for me in the past
$ ./configure --prefix=/develop/contrib/curl-7.18.0 --enable-static
--disable-shared --disable-ftp --disable-file --disable-ldap
--disable-ldaps --disable-dict --disable-telnet --disable-tftp
--disable-manual --disable-ipv6 --disable-verbose --disable-ares
--disable-sspi --disable-crypto-auth --disable-cookies --without-ssl
--without-zlib --without-libssh2 --without-ca-bundle -without-ca-path
--without-libidn CC='cl -nologo -DCURL_STATICLIB' LDFLAGS=ws2_32.lib

# This is what I have had to use as of 7.18.2
$ ./configure --prefix=/develop/contrib/curl-7.18.2 --enable-static
--disable-shared --disable-ftp --disable-file --disable-ldap
--disable-ldaps --disable-dict --disable-telnet --disable-tftp
--disable-manual --disable-ipv6 --disable-verbose --disable-ares
--disable-sspi --disable-crypto-auth --disable-cookies --without-ssl
--without-zlib --without-libssh2 --without-ca-bundle -without-ca-path
--without-libidn CC='cl -nologo -DCURL_STATICLIB' LDFLAGS='ws2_32.lib
winmm.lib' winsock_LIB=ws2_32.lib

>
>> HAVE_WINSOCK2_H is configured after gethostbyname is configured.
>
> Is it really? The way I read configure.ac, winsock2.h is checked for at line
> 227, while gethostbyname starts to get checked for at line 467. What am I
> missing?
>

Sorry, it looks like I was missing something. I always have avoided
looking in autoconf files and just grep through the generated
configure shell script. Reading configure.ac around line 227 it would
seem that my configuration probably lands me in the default case where
winsock_h and winsock2_h are set to "no" a priori.

>> I will also use this space to complain that I now have to explicitly pass
>> winsock_LIB=ws2_32.lib on the configure command line to even get it to attempt
>> this test.
>
> "this test" being the gethostbyname one you mean?

Yes.

> That doesn't look correct to
> me either. There's no such conditional in configure.ac to at least do parts of
> the gethostbyname check unregarding to what you set winsock_LIB to. I guess I
> just don't understand your remark here.
>

On further consideration this is probably also due to some a priori
judgment in configure.ac that winsock is not appropriate for my
environment ... and what I have found is some internal variable that
it used to track that judgment.

> Can you please provide configure outputs or possibly config.log snippests to
> clarify your statements with?
>

Yes, config.log excerpts provided below.

>

I guess this problem boils down to the configure script setting values
based on assumption instead of actual tests. I thought the entire
point of these scripts is to run the test and not rely on host
identifier tags, etc.

Thanks for the attention here and also for the quick reply.

Kind regards,
Michael James

*** config.log snip from 7.18.1 ***

configure:22001: checking for gethostbyname in ws2_32
configure:22026: cl -nologo -DCURL_STATICLIB -o conftest.exe
ws2_32.lib winmm.lib conftest.c -lws2_32 >&5
conftest.c
cl : Command line warning D9035 : option 'o' has been deprecated and
will be removed in a future release
cl : Command line warning D9002 : ignoring unknown option '-lws2_32'
configure:22032: $? = 0
configure:22039: result: yes

*** config.log snip from 7.18.2 ***

configure:22103: checking for gethostbyname in ws2_32.lib
configure:22144: cl -nologo -DCURL_STATICLIB -o conftest.exe
ws2_32.lib winmm.lib conftest.c ws2_32.lib >&5
conftest.c
conftest.obj : error LNK2019: unresolved external symbol
_gethostbyname referenced in function _main
conftest.exe : fatal error LNK1120: 1 unresolved externals
cl : Command line warning D9035 : option 'o' has been deprecated and
will be removed in a future release
configure:22150: $? = 2
configure: failed program was:
|
| /* confdefs.h. */
| #define PACKAGE_NAME "curl"
| #define PACKAGE_TARNAME "curl"
| #define PACKAGE_VERSION "-"
| #define PACKAGE_STRING "curl -"
| #define PACKAGE_BUGREPORT "a suitable curl mailing list =>
http://curl.haxx.se/mail/"
| #define PACKAGE "curl"
| #define VERSION "7.18.2"
| #define OS "i686-pc-cygwin"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #ifndef __cplusplus
| #define inline __inline
| #endif
| #define HAVE_WINDOWS_H 1
| #define WIN32_LEAN_AND_MEAN 1
| #define CURL_DISABLE_FTP 1
| #define CURL_DISABLE_FILE 1
| #define CURL_DISABLE_LDAP 1
| #define CURL_DISABLE_LDAPS 1
| #define CURL_DISABLE_DICT 1
| #define CURL_DISABLE_TELNET 1
| #define CURL_DISABLE_TFTP 1
| /* end confdefs.h. */
|
| #ifdef HAVE_WINDOWS_H
| #ifndef WIN32_LEAN_AND_MEAN
| #define WIN32_LEAN_AND_MEAN
| #endif
| #include <windows.h>
| #ifdef HAVE_WINSOCK2_H
| #include <winsock2.h>
| #else
| #ifdef HAVE_WINSOCK_H
| #include <winsock.h>
| #endif
| #endif
| #endif
|
| int
| main ()
| {
|
| gethostbyname("www.dummysite.com");
|
| ;
| return 0;
| }
|
configure:22166: result: no
Received on 2008-06-06