cURL / Mailing Lists / curl-library / Single Mail


Recent problems with ares and memdebug

From: Tor Arntsen <>
Date: Wed, 18 Feb 2004 14:10:05 +0100

(AIX debug+ares build)

testcurl: build ares
xlc -c -DCURLDEBUG -I../include -g -g -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" ../../curl/ares/ares__close_sockets.c
"../../curl/ares/../lib/memdebug.h", line 54.47: 1506-046 (S) Syntax error.
"../../curl/ares/../lib/memdebug.h", line 54.24: 1506-310 (I) The type "struct sockaddr" was introduced in a parameter list, and will go out of scope at the end of the function declaration or definition.
make: *** [ares__close_sockets.o] Error 1

This fails because in lib/memdebug.h there's the following constructs:
#include <sys/types.h>
#include <sys/socket.h>
followed by a curl_accept that used to need 'struct sockaddr'.

(NB: I know that Daniel just checked in a change to memdebug.h that removed
that, just minutes ago. However, I'll argue for a more fundamental problem,
if I may)

Now, because memdebug.h is included from ares, HAVE_SYS_TYPES_H and
HAVE_SYS_SOCKET_H are not defined, as ares doesn't have a config.h.
This just happened to work on Linux, because Linux through some convoluted
ways <bits/socket.h> would be included through Linux' <netinet/in.h> and
<bits/socket.h> defines struct sockaddr on Linux.

Wouldn't the best fix be to let ares/ get its own config.h, like src and lib?
It runs its own ./configure script, after all.

A related problem is this failure on IRIX:

gcc -c -DCURLDEBUG -g -g -W -Wall -Wwrite-strings -pedantic -Wno-long-long -Wundef -Wpointer-arith -Wnested-externs -Wcast-align -Winline -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wshadow -Wsign-compare -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" ../../curl/ares/ares__close_sockets.c
In file included from ../../curl/lib/memdebug.h:25,
from ../../curl/ares/ares_private.h:152,
from ../../curl/ares/ares__close_sockets.c:22:
../../curl/lib/setup.h:117:30: curl/stdcheaders.h: No such file or directory

This is also because ares doesn't have a config.h that can define STDC_HEADERS:
#ifndef STDC_HEADERS /* no standard C headers! */
#ifdef VMS
#include "../include/curl/stdcheaders.h"
#include <curl/stdcheaders.h>

The above would fail everywhere, but just happens to work on e.g. my ia64
builds (and, I suspect, on Daniel's linux+debug+ares builds), because curl
is also installed as a system library, and thus there exists a file
/usr/include/curl/stdcheaders.h which is picked (incorrectly) by the build!

Again, that could also be fixed if ares had its own config.h file I think.

Received on 2004-02-18