simple compile

John Van Essen vanes002 at umn.edu
Tue Oct 28 12:49:39 EST 2003


Hi Tom,

I think your problem is that the rsync configure is failing the test
for detecting that the getaddrinfo routine is available, but yet some
of the defines are available (but not the ones producing the errors).

This seems to be specific to your OSF system, perhaps?


The relevant lines from configure.in:

# Irix 6.5 has getaddrinfo but not the corresponding defines, so use
#   builtin getaddrinfo if one of the defines don't exist
AC_CACHE_CHECK([whether defines needed by getaddrinfo exist],
               rsync_cv_HAVE_GETADDR_DEFINES,[
                        AC_EGREP_CPP(yes, [
                        #include <sys/types.h>
                        #include <sys/socket.h>
                        #include <netdb.h>
                        #ifdef AI_PASSIVE
                        yes
                        #endif], 
                        rsync_cv_HAVE_GETADDR_DEFINES=yes,
                        rsync_cv_HAVE_GETADDR_DEFINES=no)])
if test x"$rsync_cv_HAVE_GETADDR_DEFINES" = x"yes"; then
        # Tru64 UNIX has getaddrinfo() but has it renamed in libc as
        # something else so we must include <netdb.h> to get the
        # redefinition.
        AC_CHECK_FUNCS(getaddrinfo, ,
                [AC_MSG_CHECKING([for getaddrinfo by including <netdb.h>])
                AC_TRY_LINK([#include <sys/types.h>
                #include <sys/socket.h>
                #include <netdb.h>],[getaddrinfo(NULL, NULL, NULL, NULL);],
                        [AC_MSG_RESULT([yes])
                        AC_DEFINE(HAVE_GETADDRINFO, 1,
                                [Define if you have the `getaddrinfo' function.])],
                        [AC_MSG_RESULT([no])
                        AC_LIBOBJ(lib/getaddrinfo)])])


The relevant lines from lib/getaddrinfo.h:

/**
 * @file addrinfo.h
 *
 * Replacement getaddrinfo() for machines that don't have it.  The new
 * getaddrinfo()/getnameinfo() interface is implemented on top of the
 * traditional resolver calls.
 **/

#ifndef HAVE_GETADDRINFO

#ifndef EAI_ADDRFAMILY
/*
 * Error return codes from getaddrinfo()
 */
#define EAI_ADDRFAMILY   1      /* address family for hostname not supported */
...


Here's my guess...

- The configure process can't find gettaddrinfo, so HAVE_GETADDRINFO is
  undefined and lib/getaddrinfo.c gets compiled.
- #ifndef HAVE_GETADDRINFO (above) will always succeed (since by definition
  compiling the gettaddrinfo module means it does not have getaddrinfo)
  so it continues on to (try to) define the EAI symbols locally.
- But apparently EAI_ADDRFAMILY is already defined in some preceding
  system include file, and so it skips the local definitions, thus
  triggering your compile errors.

Indeed, EAI_ADDRFAMILY is defined in <netdb.h>.
(I see Mr. Malmberg has just pointed this out).

Look in your config.log file for a line like this:

configure:7382: checking whether defines needed by getaddrinfo exist

and see what the next 10 lines or so are.  Mine are:

configure:7382: checking whether defines needed by getaddrinfo exist
configure:7408: result: yes
configure:7418: checking for getaddrinfo
configure:7461: gcc -o conftest -g -O2 -DHAVE_CONFIG_H -Wall -W   conftest.c -lresolv  >&5
configure:7464: $? = 0
configure:7467: test -s conftest
configure:7470: $? = 0
configure:7480: result: yes

..which says that the defines and the function are both available.

What does yours say?  The line numbers might be different.
-- 
        John Van Essen  Univ of MN Alumnus  <vanes002 at umn.edu>



On Mon, 27 Oct 2003, Tom Holton <holton at mbi.ucla.edu> wrote:
> 
> Hi, thanks for the reply. I apologize for not having a clearer question.
> I did know that EAI_MAX was in lib/addrinfo.h
> I have been able to produce an executable by simply copying 4 lines from
> lib/addrinfo.h into lib/getaddrinfo.c
> #define EAI_BADHINTS    12
> #define EAI_PROTOCOL    13
> #define EAI_MAX         14
> #define AI_MASK         (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST)
> 
> but I am guessing that this is not the preferred solution.
> 
> I am assuming linux compilers or gcc do not get this problem, so
> I thought it might by important to have a correction for this on oSF.
> 
> thanks for your help,
>
>
> On Mon, 27 Oct 2003, jw schultz wrote:
> 
>> On Mon, Oct 27, 2003 at 03:39:37PM -0800, Tom Holton wrote:
>> >
>> > I could not find this question anywhere, but I apologize if it is and I
>> > just missed it.
>> >
>> > Running an Alpha, OSF1 V5.1 1885
>> >
>> > configure went fine.
>> >
>> > compile failed:
>> >
>> > cc -I. -I. -g -DHAVE_CONFIG_H -I./popt -c lib/getaddrinfo.c -o
>> > lib/getaddrinfo.o
>> > cc: Error: lib/getaddrinfo.c, line 182: In this statement, "EAI_MAX" is
>> > not declared. (undeclared)
>> >         if (ecode < 0 || ecode > EAI_MAX)
>> > ---------------------------------^
>> > cc: Error: lib/getaddrinfo.c, line 264: In this statement, "EAI_BADHINTS"
>> > is not declared. (undeclared)
>> >                         ERR(EAI_BADHINTS); /* xxx */
>> > ------------------------^
>> > cc: Error: lib/getaddrinfo.c, line 265: In this statement, "AI_MASK" is
>> > not declared. (undeclared)
>> >                 if (hints->ai_flags & ~AI_MASK)
>> > ---------------------------------------^
>> > cc: Error: lib/getaddrinfo.c, line 299: In this statement, "EAI_BADHINTS"
>> > is not declared. (undeclared)
>> >                                 ERR(EAI_BADHINTS);      /*xxx*/
>> > --------------------------------^
>> > cc: Error: lib/getaddrinfo.c, line 305: In this statement, "EAI_BADHINTS"
>> > is not declared. (undeclared)
>> >                                 ERR(EAI_BADHINTS);      /*xxx*/
>> > --------------------------------^
>> > cc: Error: lib/getaddrinfo.c, line 355: In this statement, "EAI_PROTOCOL"
>> > is not declared. (undeclared)
>> >                                         ERR(EAI_PROTOCOL);      /*xxx*/
>> > ----------------------------------------^
>> > *** Exit 1
>> >
>> >
>> > See no documentation about EAI_MAX
>> >
>> > And, looking in the code, indeed, EAI_MAX (et. al.) are not defined
>> > anywhere!
>>
>> It is defined in lib/addrinfo.h and included from rsync.h
>>
>> >
>> > How should I handle this?
>> >
>> > thanks,
>> > -tom
>> >
>> >
>> > --
>> > To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
>> > Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
>> >
>>
>> --
>> ________________________________________________________________
>>         J.W. Schultz            Pegasystems Technologies
>>         email address:                jw at pegasys.ws
>>
>>                 Remember Cernan and Schmitt




More information about the rsync mailing list