[jamming] Jam always rebuilds

Diane Holt holtdl at yahoo.com
Fri Nov 19 14:54:44 PST 2004


It's historical. At the company where Jam was first used, we used to have
all the libraries set as vars in a config file. Their value was a full
path to the lib, and they were referenced in Jamfiles by their var name
(eg., $(FOOLIB)).

Diane

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

> Hi Diane,
> 
> I realized that that section of LibraryFromObjects was causing the
> problem, but I was puzzled by that "For compatibility, we only do this
> if the library doesn't already have a path". Does that mean
> compatibility with some older version of Jam or compatibility with some
> other rule or external tool or policy? If it's the former, I'd say the
> solution would be to override LibraryFromObjects using an unconditional
> MakeLocate. However, it seems the idea is not to override a directory
> specification already "attached" to a library with a "context derived"
> directory, but in the process we lose the ability to create the
> directory the first time around. Perhaps LibraryFromObjects should do a
> conditional "LOCATE on" but an unconditional MkDir (since in any case
> MkDir prevents attempts to create directories that already exist).
> 
> Joe Abbate
> Senior Software Engineer
> Computer Associates
> joseph.abbate at ca.com
> 
> -----Original Message-----
> From:	Diane Holt [mailto:holtdl at yahoo.com]
> Sent:	Fri 11/19/2004 3:49 PM
> To:	Abbate, Joseph M; Mihai Christodorescu; jamming at perforce.com
> Cc:	
> Subject:	RE: [jamming] Jam always rebuilds
> 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)
> 
> 
> 
> 
> 
> 
> 


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





More information about the jamming mailing list