[OpenAFS] Re: Failure to build OpenAFS 1.6.1a

Russ Allbery rra@stanford.edu
Tue, 09 Oct 2012 10:23:00 -0700

Andrew Deason <adeason@sinenomine.net> writes:

> The build failing with heimdal installed is something I can reproduce.
> What I believe is happening is that libkrb5 is something we can pick up
> without any extra flags (e.g. /usr/lib64/), but krb5.h is somewhere else
> (/usr/heimdal/include).

> We may want to try probing /usr/heimdal/bin/krb5-config in the krb5
> configure logic.

/usr/bin/krb5-config.heimdal is how Debian spells this.  I've been
avoiding doing either, though, because usually MIT is available as the
system library and that krb5-config will be found first, so I don't think
adding /usr/heimdal/bin to the search path will actually help anything.

> We also probably need to do better about detecting the proper header vs
> detecting libraries, apparently... (I haven't looked at this in detail,
> maybe this is better in master or something)

I'm able to build my Kerberos packages with both Heimdal and MIT installed
on the system on different paths, so I know that the macros work and
produce the right flags.  However, you do have to be very careful about
what other flags you pass in and the ordering of flags.  Generally, you
need to put KRB5_CPPFLAGS before anything else in your CPPFLAGS setting,
and likewise with KRB5_LDFLAGS and LDFLAGS.  Otherwise, if you have
anything that (erroneously) adds -L/usr/lib or -L/usr/lib64 to your link
flags, you will pick up the default Kerberos library instead of the one
that you wanted.

Unfortunately, this is to some extent an unavoidable limitation in the way
that one specifies paths to a compiler.  There isn't any way to portably
pass in a -L flag that applies only to a specific -l flag but not to any
other, so if you have multiple libraries that you're linking with at
different paths, you can create situations where it's actually impossible
to specify exactly the libraries you want.

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