Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-06-23 08:39:27


Hi Jürgen,

> Fixed this in new project (attached). It now includes the missing .o
> and .lib files from extern library.
>
> And now get the correct (!) error message:

And I'm able to correctly diagnose the problem. It seems like we've fixed all
the simple errors in V2 ;-) -- this one is a combination of three things:

1. You have <library>......something.o in top-level requirements. So all
target, *even 'stage'*, gets "something.o" added to the list of sources.
That's why the stage rules stages the object files.

2. The rule which creates virtual targets from files has this comment:
# FIXME: more correct way would be to compute path to the file, based on name
and source location
# for the project, and use that path to determine if the target was already
created.

In other words, it though that something.o referered from two different
project are not related. Cool, isn't it?

3. Third problem, which is apparent only after I fix the second, is that the
rule which determines, for each new virtual target, if there's equivalent one
already, looked at project, too. So, two virtual targets created by two
different 'stage' rule which corresponded to copied versions of 'something.o'
were considered different. Luckily, we had this "duplicate targets checks" as
the last defence, which fired an error -- otherwise, something.o would be
copied twice, or maybe 10 times in a row.

I think I've fixed the second and the third problem with the attached patch.
It's very dirty and there are no regression tests yet, so I can't commit it
today. However, if you could test with it applied, that would be great.

As for the first issue, I'm not 100% sure. I kinda expected that stage rule
would be located in top-level, as opposed to in each Jamfile, so I can't
suggest a solution off-hand.

- Volodya
 --Boundary-00=_PgY2Aw9ec5PnQ+u Content-Type: text/x-diff;
charset="utf-8";
name="virtual-target.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="virtual-target.diff"

Index: virtual-target.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/build/virtual-target.jam,v
retrieving revision 1.81
diff -u -r1.81 virtual-target.jam
--- virtual-target.jam 23 Jun 2004 10:56:34 -0000 1.81
+++ virtual-target.jam 23 Jun 2004 13:35:49 -0000
@@ -716,10 +716,17 @@
rule from-file ( file : project )
{
import type ; # had to do this here to break a circular dependency
+
+ # Check if we've created a target corresponding to this file.
+ local source-location = [ $(project).get source-location ] ;
+ local path = [ path.root [ path.root [ path.make $(file) ] $(source-location) ]
+ [ path.pwd ] ] ;

- if $(.files.$(file).$(project))
+# ECHO "PATH = " $(path) ;
+
+ if $(.files.$(path))
{
- return $(.files.$(file).$(project)) ;
+ return $(.files.$(path)) ;
}
else
{
@@ -737,7 +744,8 @@
$(v).suffix [ MATCH ^.(.*)$ : $(file:S) ] ;
result = $(v) ;
}
- .files.$(file).$(project) = $(result) ;
+ .files.$(path) = $(result) ;
+# ECHO "Created " $(result) ;
return $(result) ;
}
}
@@ -750,6 +758,15 @@
{
local signature = [ sequence.join
[ $(target).project ] [ $(target).name ] [ $(target).type ] : - ] ;
+ local signature2 = [ sequence.join
+ [ $(target).actual-name ] : - ] ;
+# if [ $(target).actual-name ] = <l.>x.h
+# {
+# errors.backtrace 1 "" ;
+# }
+
+ signature = $(signature2) ;
+
local result ;
for local t in $(.cache.$(signature))
{
@@ -774,14 +791,35 @@
if $(p1) = $(p2)
{
result = $(t) ;
+ # ECHO "Got existing target" ;
}
}
}
}
}
+
+ if $(.cache.$(signature)) != $(.cache2.$(signature2))
+ {
+# ECHO "Differ" $(signature) $(signature2) ;
+# ECHO ":" $(.cache.$(signature)) "--" $(.cache2.$(signature2)) ;
+# if [ $(target).action ]
+# {
+# ECHO "HAS ACTION" ;
+# }
+ # errors.backtrace 1 "" ;
+
+ }
+
if ! $(result)
{
.cache.$(signature) += $(target) ;
+ .cache2.$(signature2) += $(target) ;
+# ECHO "PUTTING" $(target) $(signature) $(signature2) ;
+ if [ $(target).action ]
+ {
+ # ECHO "HAS ACTION" ;
+ }
+
result = $(target) ;
}

@@ -924,7 +962,7 @@
#
# The 'new-project' parameter tells what project should be assigned
# for newly created non-source targets.
-rule clone-template ( target dont-recurse ? : new-source : new-project )
+rule clone-template ( target dont-recurse ? : new-source : new-project : dont-register ? )
{
local name = [ $(new-source).name ] ;
local old-name = [ $(target).name ] ;
@@ -963,7 +1001,8 @@
if $(t) != $(target)
{
cloned-targets +=
- [ clone-template $(t) dont-recurse : $(new-source) : $(new-project) ] ;
+ [ clone-template $(t) dont-recurse : $(new-source) : $(new-project)
+ : dont-register ] ;
}
}
local cloned-targets2 ;
@@ -979,7 +1018,10 @@
}
else
{
- cloned = [ register $(cloned) ] ;
+ if ! $(dont-register)
+ {
+ cloned = [ register $(cloned) ] ;
+ }
}
return $(cloned) ;
}
 --Boundary-00=_PgY2Aw9ec5PnQ+u--


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk