Subject: NetBSD -current + Courier error: Cannot find function res_query
To: None <courier-users@lists.sourceforge.net>
From: Brian A. Seklecki <lavalamp@spiritual-machines.org>
List: tech-pkg
Date: 03/02/2004 22:48:52
I haven't had a chance to dig through CVS commit logs on both NetBSD and
Courier to find out when this started happening, but with the
0.44.2.20040222 snapshot, GNU autoconf is failing this test:

checking whether -lresolv is needed for res_query... configure: error:
Cannot find function res_query
configure: error: /usr/pkg/bin/bash './configure' failed for courier

/courier/config.log error:

configure:19581: result: no
configure:19589: checking whether -lresolv is needed for res_query
configure:19612: gcc -o conftest -I./.. -I.. -I./../afx -I./../rfc822
-I./libs -g -O2   conftest.c   >&5
In file included from configure:19616:
/usr/include/resolv.h:131: error: field `nsaddr_list' has incomplete
type
/usr/include/resolv.h:141: error: field `addr' has incomplete type
/usr/include/resolv.h:156: error: field `ina' has incomplete type
/usr/include/resolv.h:157: error: field `in6a' has incomplete type
configure:19615: $? = 1
configure: failed program was:
| #line 19591 "configure"
| /* confdefs.h.  */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE "courier"
| #define VERSION "0.44"
| #ifdef __cplusplus
| #include <stdlib.h>
| #endif
| #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
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| /* end confdefs.h.  */
|
| #include <resolv.h>
|
| void (*func)()= (void (*)())res_query;
|
| int
| main ()
| {
|   (*func)();
|   ;
|   return 0;
| }
configure:19653: gcc -o conftest -I./.. -I.. -I./../afx -I./../rfc822
-I./libs -g -O2   conftest.c -lresolv   >&5
In file included from configure:19657:
/usr/include/resolv.h:131: error: field `nsaddr_list' has incomplete
type
/usr/include/resolv.h:141: error: field `addr' has incomplete type
/usr/include/resolv.h:156: error: field `ina' has incomplete type
configure:19656: $? = 1
configure: failed program was:
| #line 19632 "configure"
| /* confdefs.h.  */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE "courier"
| #define VERSION "0.44"
| #ifdef __cplusplus
| #include <stdlib.h>
| #endif
| #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
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| /* end confdefs.h.  */
|
| #include <resolv.h>
|
| void (*func)()= (void (*)())res_query;
|
| int
| main ()
| {
|   (*func)();
|   ;
|   return 0;
| }
configure:19674: error: Cannot find function res_query

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=i386-unknown-netbsdelf1.6ZI
ac_cv_build_alias=i386-unknown-netbsdelf1.6ZI
ac_cv_c_compiler_gnu=yes
ac_cv_cxx_compiler_gnu=yes

[....snip...]


---------------------------------------------------

Adding : 

#include <netinet/in.h>

... brings in the appropriate data structures includes to make this test
code work.  It should be noted that the NetBSD -rHEAD CVS tree hasn't
changed include/resolv.h in 6+ months.  

http://cvsweb.netbsd.org/bsdweb.cgi/src/include/resolv.h

Additionally not to my knowledge has resolv.h ever #include'd
include/netinet/*h.  On my Linux box, include/resolv.h has:

------------------------
#ifndef _RESOLV_H_

/* These headers are needed for types used in the `struct res_state'
   declaration.  */
#include <sys/types.h>
#include <netinet/in.h>

#ifndef __need_res_state
# define _RESOLV_H_
------------------------

A GNU Autoconf hack may need to be put in place.

-Brian