[PATCH] some fixes for waf issues

Andrew Bartlett abartlet at samba.org
Mon Jan 13 14:41:01 MST 2014

On Mon, 2014-01-13 at 21:58 +0100, Christian Ambach wrote:
> Am 08.01.14 21:14, schrieb Andrew Bartlett:
> > On Wed, 2014-01-08 at 20:40 +0100, Christian Ambach wrote:
> >> I am not sure how we should correctly deal with this.
> >> Examining the configure logs on AIX I we might want to change our
> >> detection strategy:
> >> The special case on AIX is that libintl.a exists, but libintl.h not.
> >> Without the link check, waf fails to detect gettext and friends because
> >> there is no header around that would declare them when it tries to
> >> compile code like this:
> >> int main(void){void *__x = (void *)dgettext;return (int)__x;return 0;}
> >>
> >> When enabling the link check (that is enabled by default), it compiles
> >> and links the following code:
> >> #define gettext __fake__gettext
> >> [...]
> >> #undef gettext
> >> #if defined __stub_gettext || defined __stub___gettext
> >> #error "bad glibc stub"
> >> #endif
> >> extern char gettext();
> >> int main() { return gettext(); }
> >>
> >> This compiles (as gettext is declared) and links (as the symbol can be
> >> found in libintl.a).
> >> The bad thing for the "real" code is that we still do not have
> >> prototypes around and so compilation fails (because those functions do
> >> not return int, as assumed when the prototype is lacking).
> >> This might also happen with other libraries we depend on, but for some
> >> cases we need this functionality (e.g. when accessing functions in the
> >> Kerberos libs that are not declared in the public headers).
> >>
> >> I see two options here:
> >> 1. refine the configuration checks so they fail if no prototype could be
> >> found, a positive link check should not be good enough
> >> 2. declare the prototypes in lib/replace when they are missing (as for
> >> fdatasync)
> >
> > We really should avoid that, except where we are very, very sure of the
> > prototype.
> To me it seems that there is only one implementation of this library 
> that it used on all platforms. So the prototype should be pretty clear.
> >> I would lean towards option 2 as it is less intrusive than changing
> >> the behavior of configure checks for everything that we check for.
> >> This is what you can find in the attached patchset and what is reported
> >> to fix the build on AIX by the bug reporter.
> >
> > I think 1 is the better option, unless there is a very pressing need for
> > intl on AIX and really no way to install the correct headers.
> If we go with option 1 and change the behavior of configure checks to 
> only make use of a function if the prototype is present and the 
> resulting binary could be linked successfully, it might open up a can of 
> worms if the change is done to the configure checks in general, 
> affecting all checks.
> There are known examples that will fail then, like fdatasync on MacOS.
> So this check should better be local to the gettext configure checks.
> How about changing them to only enable gettext support if the prototypes 
> could be found and linking succeeds?

Yes.  That is the standard approach for this kind of situation. 

> > I've been doing some build farm work, and disabled gettext on
> > SerNet-imini.  If MacOS now builds, we may need to unpatch the build
> > farm.  I just mention this so we don't forget.
> Thanks for doing that.. I brought this up a while ago, but it got lost 
> at that time it seems.
> > The link of 'optional, but you really want' features that we now require
> > you to specify --without-xxx for is currently:
> >   - acl-support
> >   - gettext
> >   - ldap
> >   - ads-support
> Is gettext really that important? Not having it will "just" leave you 
> without localized error messages for the minority of Samba binaries and 
> libraries. When the new patches have landed, this can be removed again.

Indeed.  I was surprised to see it made mandatory, when important things
like ACLs, xattr and LDAP were not at that point.  Just make sure we
undo the build farm changes if we change the rules here. 

Andrew Bartlett

Andrew Bartlett
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba

More information about the samba-technical mailing list