[OpenAFS] Re: 1.6.2 compilation notes, Sol10
Thu, 28 Mar 2013 13:03:13 -0700
Andrew Deason <firstname.lastname@example.org> writes:
> For the linker? I thought for linking all it did was -lpthread (though
> it may do other things for the preprocessor or compiler). It's not a
> valid option to GNU ld, either.
It's opaque to the user. Basically, the gcc documentation says "use
-pthread and then we guarantee it works properly across platforms." I
believe on some platforms it may change which libc is linked, for
instance. (Doesn't AIX require linking with libc_r instead?)
> It doesn't seem great to me to require the same compiler for shared
> libraries; aside from "layering violation" objections or whatever, it's
> just not practical in many environments. But if gcc requires -pthreads,
> and Studio requires -mt -lpthread, then obviously you can't give the
> same flags for both.
And in general, for any library that requires special pkgconfig handling
and flags or the like, mixing compilers just isn't going to work in
practice (whether it should or not).
> Or if it works when pthreads are not linked in, then it shouldn't be in
> libs at all, since the calling build system will pass the necessary
> stuff for multithreaded code if it wants it. For OpenAFS, it seems like
> we should be able to strip it out and put in threaded-ness according to
> our own logic. Do we need to always add -lpthread etc, even if we want
> to use libkrb5 in a non-threaded program?
MIT Kerberos definitely requires (or at least required) linking with
pthreads, since without it you get undefined references to
pthread_setspecific and the like on platforms without transitive shared
library dependency closure. I don't know if Heimdal is similar.
Remember, the hard case for library probes is not ELF platforms, where
shared libraries can declare dependencies on other shared libraries, thus
making the problem much easier. (Not that the current manual Heimdal
probes work with modern Heimdal at all on those platforms, due to the
missing underlying Heimdal libraries. But that's exactly why we prefer
krb5-config and try to avoid manual probing if at all possible.)
> I can get this to work, but I assume from your other email you want this
> in OpenAFS and not rra-c-util.
No, regardless of the underlying issue, the current manual library probing
for Heimdal libraries in rra-c-util is broken, and I'm happy to fix that
in rra-c-util by probing for the additional libraries.
Russ Allbery (email@example.com) <http://www.eyrie.org/~eagle/>