[OpenAFS] Trouble compiling 1.4rc4 SRPM

Russ Allbery rra@stanford.edu
Thu, 22 Sep 2005 11:56:19 -0700

Kurt Seiffert <seiffert@indiana.edu> writes:

> I'm trying to compile openafs 1.4.0rc4 from the SRPM's. I am trying  
> this on both RHEL AS 3 and RHEL AS 4.

> Openafs itself seems to compile OK but when the rpmbuild runs the  
> configure script for afs-krb5 it gets the following error:

> checking for res_search in -lresolv... no
> configure: error: Unable to find res_search function

Yup, you're on AMD64.  This is a problem specific to the AMD64 glibc
libraries.  Basically, glibc on AMD64, but not on i386, hides res_search
in a way that still works for normal code but doesn't work for the way
Autoconf constructs its library probes (since it assumes that the code
being compiled has included the relevant header).

The simple cheat is to search for __res_search instead, and in fact a
simple perl -i -pe 's/\bres_search\b/__res_search/g' configure will
generally fix it on that platform.

The slightly more robust cheat is to change anything like:

    AC_SEARCH_LIBS([res_search], [resolv])

in configure.in or wherever to:

    AC_SEARCH_LIBS([res_search], [resolv], ,
        [AC_SEARCH_LIBS([__res_search], [resolv])])

The actually correct thing to do is to not use AC_SEARCH_LIBS and instead
use one of the other probe mechanisms that lets you force the inclusion of
an additional header in the library probe and then include arpa/nameser.h
and resolv.h.  Autoconf doesn't provide a nice way to do this,
unfortunately, but the src/cf/ressearch.m4 file in OpenAFS defines a macro
that does the right thing.

Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>