cURL / Mailing Lists / curl-library / Single Mail


Re: gethostbyname & MinGW build problem

From: Gour <>
Date: Fri, 19 Dec 2003 14:13:55 +0100

Daniel Stenberg ( wrote:

> There are, but why is that an issue here?

Well, as far as I can see, curl's configure script does not include <winsock.h>
or <winsock2.h> where there is declaration for gethostbyname().

Here is the snippet from config.log:

configure:19996: checking for gethostbyname
configure:20046: gcc -o conftest.exe -g -O2 conftest.c >&5
c:/windows/temp/cceJfPfb.o(.text+0x1a): In function `main':
C:/MSYS/1.0/home/gour/curl-7.11.0-20031219/configure:20058: undefined reference
to `gethostbyname'
/configure:20057: undefined reference to `gethostbyname'
configure:20049: $? = 1

> This is indeed a good test to detect libcurl. This probably fails because the
> compiler (or rather the linker) doesn't know in what directory to find
> libcurl. This might be able to cure by setting LDFLAGS=-L/path/to/dir before
> you run configure.

I doubt it's so since all the required libraries (like zlib which is found) are
in the same place /mingw/lib, and as you can see from above, the problem is
undefined reference.

> If I were to make that program to link with libcurl, I'd:
> 1. try setting LDFLAGS etc when I invoke configure to be sure it can link with
> libcurl for tests. Also, I'd check if the configure script takes some nice
> options that would help.
> and it that fails:
> 2. I'd run configure without libcurl support, and then modify the config.h and
> Makefiles afterwards accordingly to use libcurl.

First I have to find out what is the minimal requirement to compile the
conftest.exe with MinGW which use e.g. gethostbyname().

Unfortunately, I'm not a developer, just trying to compile the program for Win
so that it can get wider audience.

> > is much simpler/better than fiddling with makefiles.
> I would love to have this work for curl too.


> > If it's possible to compile whole wxWindows library in MinGW/MSYS
> > environment, it should be possible to for curl too.
> I agree. But since I don't have that environment setup myself, I have limited
> ability to make it work myself.

Similar is with darcs - author works on Linux and there everything works.
Somehow I have ability to simply test programs on Win98 which runs under
win4lin, so it is not too much hassle (no need for dual boot :-) to compile
something in MSYS/MinGW environment (things just run in another full-screen


Registered Linux User #278493
This email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now!
Received on 2003-12-19