3.0alpha24: make bug (or more...)

Andrew Bartlett abartlet at samba.org
Fri May 16 00:57:01 GMT 2003

On Fri, 2003-05-16 at 05:40, David Lee wrote:
> On Thu, 15 May 2003, David Lee wrote:
> > I grabbed 3.0alpha24 this morning and began to build it, and quickly hit a
> > bug.  (Our platform is Sun/Solaris8 but the bug is a general one.)  I
> > logged a patch (bugzilla 83), but it looks as though one bug leads to
> > another and so on...
> >
> > The problem (or connected string of them) probably won't affect a simple
> > "builddir == srcdir" configuration.
> >
> >
> > But for those sites (e.g. with multiple architectures) which use multiple
> > "builddir", separate from each other and from "srcdir", the start of this
> > potentially long string is immediately evident.
> >
> > [...]
> > For the curious:
> >
> >   cd source
> >   mkdir builddir_1
> >   cd builddir_1
> >   ../configure  <... your favourite --options>
> >   make
> >
> >
> > The "make" will fail, unable to write "smbd/build_options.c" because
> > directory "builddir_1/smbd" does not exist.  That is easily fixed by the
> > one-line patch in bugzilla 83.
> >
> >
> > But then the fun starts, and the string seems to get longer, as it cannot
> > completely build "include/proto.h".  (And I think there is a philosophical
> > mistake in its trying to build it in "$(srcdir)": it ought to be in
> > "$(builddir)".  Etc.)
> Further to my message above.
> At the time I sent it, I had already done some work, but it had seemed
> that each step forward revealed two or more further steps that would need
> to be taken.  At the time, it was looking increasingly worrying.
> Anyway.  I think I've fixed it, and (I hope) done so reasonably cleanly.
> To re-iterate:  The problem almost certainly only affects sites where
> "builddir != srcdir".  (If your site has them equal, then you may
> reasonably be wondering what the fuss is about!)
> Four files are affected:
>    Makefile.in
>    script/mkproto.sh
>    configure.in
>    nsswitch/winbindd.h
> The trigger is that "proto.h" doesn't build under these circumstances
> ("builddir != srcdir"), because it needs to reference the new (at alpha24)
> "smbd/build_options.c" file.  Quite rightly, this is built in $(builddir).
> But it (a ".c") file is now in with ".o" files and so is isolated from the
> other ".c" sources.

OK - that's a bug then.  Just make it not reference that file, and
include the prototype of the single externally callable function in our
other headers.

> The first part of the solution is to rework Makefile.in's calling of
> script/mkproto.sh and the latter's internal detail.  Hitherto Makefile.in
> had invoked script/mkproto.sh with a mixture of mostly ".o" but the
> occasional ".c" (the new "smbd/build_options.c").  mkproto.sh had then
> simply translated ".o" suffixes to ".c" and prepended with "$(srcdir)".
> But that was incorrect for the unusually (but correctly) placed
> "smbd/build_options.c".
> So I have tidied that up.  Those name transformations are now done within
> the Makefile, which knows this idiosyncracy.  Its call of script/mkproto.sh
> is now with the ".c" files and their correct locations: usually $(srcdir),
> but in the case of "smbd/build_options.c", this is $(builddir).
> Also, within Makefile.in I had to separate out "smbd/build_options"
> references because of the its ".c" file's "special case" location.

Sounds good.  Once you have done that, it's easy to drop from

> Another problem of Makefile's invocation of "mkproto.sh" was that it was
> putting the output files relative to $(srcdir): the wrong place, which
> could potentially break multiple builds.
> So I have now arranged for it to be run in the context of, and placing its
> output relative to, $(builddir) instead.  The rest of the Makefile's
> (correct) use of $(srcdir) and $(builddir) makes this correction
> transparent.
> A side-effect within "mkproto.sh" of its now being in the $(builddir)
> context is that the location of "mkproto.awk", a $(srcdir) item, now needs
> explicitly stating within it.  But this varies according to the relative
> positioning of $(srcdir) and $(builddir).
> Accordingly, "mkproto.sh" is renamed to "mkproto.sh.in" and a
> corresponding one line change applied in "configure.in".
> Basically this then built, although it did expose one weakness in one
> compilation, trivially fixed by redefining an "include" with
> "nsswitch/winbindd.h".
> I attach four "diff -u".
> 1. Makefile.in
> 2. scripts/mkproto.sh :  Note that this should be renamed to a ".in"
> 3. configure.in (to account for rename of "scripts/mkproto.sh")
> 4. nsswitch/winbindd.h

Apart from the need to just manually prototype the build_options stuff,
this patch looks good.  For one extra header prototype, it's not worth
the special case in the script.

Andrew Bartlett

Andrew Bartlett                                 abartlet at pcug.org.au
Manager, Authentication Subsystems, Samba Team  abartlet at samba.org
Student Network Administrator, Hawker College   abartlet at hawkerc.net
http://samba.org     http://build.samba.org     http://hawkerc.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.samba.org/archive/samba-technical/attachments/20030516/7ea95c78/attachment.bin

More information about the samba-technical mailing list