[jamming] Jam always rebuilds

Diane Holt holtdl at yahoo.com
Fri Nov 19 12:49:37 PST 2004


Jam's debug flags are your friend :)

If you run jam -n -d3, you'll see why this is always rebuilding -- it's
because libtest.o shows up as "missing".  If you run it at -d5, you'll see
why -- the LOCATE for libtest.a(libtest.o) is obj. And finally, if you
look at the LibraryFromObjects rule, you'll see why:

# Set LOCATE for the library and its contents.  The bound
# value shows up as $(NEEDLIBS) on the Link actions.
# For compatibility, we only do this if the library doesn't
# already have a path.

if ! $(_l:D)
{
    MakeLocate $(_l) $(_l)($(_s:BS)) : $(LOCATE_TARGET) ;
}

Your Jamfile sets LOCATE_TARGET to obj, so Jam looks for
libtest.a(libtest.o) in the obj dir, but libtest.a lives in lib, so
libtest.o comes up missing.

To fix things, you can either keep your library objects around, or you can
override LibraryFromObjects with your own.

Diane

--- "Abbate, Joseph M" <Joseph.Abbate at ca.com> wrote:

> Hi Mihai,
> 
> Sorry, my "simple" example indeed has a fatal flaw. The problem is that
> Jam still thinks it has to build a library in the source directory, but
> eventually it builds it in the lib directory. You can see this if you
> run jam -nd3, e.g.,
> 
> make    --         libx.a(func1.o)
> bind    --         libx.a(func1.o): /<path to top>/src/libx.a(func1.o)
>                                                    ^^^
> time    --         libx.a(func1.o): missing 
> 
> The simple solution is to specify a full path to the library in the
> Library invocation. The problem with that, and that I still haven't
> solved, is that the library directory *has* to exist.
> 
> Joe Abbate
> Senior Software Engineer
> Computer Associates
> joseph.abbate at ca.com
>  
> 
> > -----Original Message-----
> > From: jamming-admin at perforce.com 
> > [mailto:jamming-admin at perforce.com] On Behalf Of Mihai Christodorescu
> > Sent: Friday, November 19, 2004 11:45 AM
> > To: jamming at perforce.com
> > Subject: [jamming] Jam always rebuilds
> > 
> > 
> > I restructured my Jamfile to change the location where 
> > certain targets are 
> > stored and it rebuilds everything everytime!
> > 
> > My Jamfile:
> > ----------
> > SubDir TOP ;
> > 
> > C++ = g++ ;
> > 
> > SEARCH_SOURCE = src ;
> > LOCATE_TARGET = obj ;
> > 
> > C++Main test : test.cpp ;
> > LinkLibraries test : libtest ;
> > MakeLocate test$(SUFEXE) : bin ;
> > 
> > C++Library libtest : libtest.cpp ;
> > MakeLocate libtest$(SUFLIB) : lib ;
> > 
> > My Jamrules:
> > -----------
> > rule C++Main
> > {
> >     Main $(<) : $(>) ;
> >     LINK on $(<) = $(C++) ;
> > }
> > 
> > rule C++Library
> > {
> >     Library $(<) : $(>) ;
> >     LINK on $(<) = $(C++) ;
> > }
> > 
> > Output from Jam:
> > ----------------
> > $ jam
> > ...found 18 target(s)...
> > ...updating 3 target(s)...
> > C++ obj/libtest.o
> > Archive lib/libtest.a
> > Ranlib lib/libtest.a
> > Link bin/test
> > Chmod1 bin/test
> > ...updated 3 target(s)...
> > 
> > The updating occurs every time I run Jam, with no changes to 
> > the source 
> > files. Any help is appreciated.
> > 
> > Mihai
> > 
> > -- 
> >   - mihai at cs.wisc.edu - http://www.cs.wisc.edu/~mihai -
> > -------------------------------------------------------
> >    The man of knowledge must be able not only to love
> >   his enemies but also to hate his friends.
> >                                   - Friedrich Nietzsche
> > -------------------------------------------------------
> >      -- Feed the machine that burns in your head. --
> > _______________________________________________
> > jamming mailing list  -  jamming at perforce.com
> > http://maillist.perforce.com/mailman/listinfo/jamming
> > 
> > 
> 
> _______________________________________________
> jamming mailing list  -  jamming at perforce.com
> http://maillist.perforce.com/mailman/listinfo/jamming
> 


=====
(holtdl at yahoo.com)





More information about the jamming mailing list