Boost logo

Boost-Build :

From: Chris Hoeppler (hoeppler_at_[hidden])
Date: 2006-02-17 06:24:01


Hi,

I stumbled upon a problem with the new generator when its targets are used as
source to an exe rule.

When invoked with a Jamfile containing

import src ;
my-converted-cpp my_processed : a.src b.src ;

calling bjam --v2 yields the expected result:

<bjam output>
src.convert bin\gcc\debug\a.cpp bin\gcc\debug\b.cpp

my_converter called with target: bin\gcc\debug\a.cpp bin\gcc\debug\b.cpp
source: a.src b.src
</bjam output>

However when I want to build an exe with the preprocessed sources, and extend
the Jamfile like this:

import src ;
my-converted-cpp my_processed : a.src b.src ;
exe foo : my_processed ;

I get the following error:

<bjam output>
C:/PROGRAMME/Boost/boost_1_33_1/tools/build/v2/build\virtual-target.jam:868: in
virtual-target.register-actual-name from module virtual-target
error: Duplicate name of actual target: <pbin\gcc\debug>a.cpp
error: previous virtual target { src%src.convert-a.cpp.CPP { a.src.SRC } {
b.src.SRC } }
error: created from ./my_processed
error: another virtual target { src%src.convert-a.cpp.CPP { a.src.SRC } {
b.src.SRC } }
error: created from ./my_processed
error: added properties: none
error: removed properties: none
C:/PROGRAMME/Boost/boost_1_33_1/tools/build/v2/build\virtual-target.jam:175: in
actualize-no-scanner from module object(file-target)@5
C:/PROGRAMME/Boost/boost_1_33_1/tools/build/v2/build\virtual-target.jam:110: in
object(file-target)@5.actualize from module object(file-target)@5
C:/PROGRAMME/Boost/boost_1_33_1/tools/build/v2/build\virtual-target.jam:693: in
actualize-source-type from module object(compile-action)@1
C:/PROGRAMME/Boost/boost_1_33_1/tools/build/v2/build\virtual-target.jam:714: in
actualize-sources from module object(compile-action)@1
C:/PROGRAMME/Boost/boost_1_33_1/tools/build/v2/build\virtual-target.jam:659: in
object(compile-action)@1.actualize from module object(compile-action)@1
C:/PROGRAMME/Boost/boost_1_33_1/tools/build/v2/build\virtual-target.jam:287: in
actualize-action from module object(file-target)@7
C:/PROGRAMME/Boost/boost_1_33_1/tools/build/v2/build\virtual-target.jam:182: in
actualize-no-scanner from module object(file-target)@7
C:/PROGRAMME/Boost/boost_1_33_1/tools/build/v2/build\virtual-target.jam:110: in
object(file-target)@7.actualize from module object(file-target)@7
C:/PROGRAMME/Boost/boost_1_33_1/tools/build/v2/build\virtual-target.jam:693: in
actualize-source-type from module object(action)@3
C:/PROGRAMME/Boost/boost_1_33_1/tools/build/v2/build\virtual-target.jam:714: in
actualize-sources from module object(action)@3
C:/PROGRAMME/Boost/boost_1_33_1/tools/build/v2/build\virtual-target.jam:659: in
object(action)@3.actualize from module object(action)@3
C:/PROGRAMME/Boost/boost_1_33_1/tools/build/v2/build\virtual-target.jam:287: in
actualize-action from module object(file-target)@9
C:/PROGRAMME/Boost/boost_1_33_1/tools/build/v2/build\virtual-target.jam:182: in
actualize-no-scanner from module object(file-target)@9
C:/PROGRAMME/Boost/boost_1_33_1/tools/build/v2/build\virtual-target.jam:110: in
object(file-target)@9.actualize from module object(file-target)@9
C:/Programme/Boost/boost_1_33_1/tools/build/v2\build-system.jam:285: in load
from module build-system
C:\PROGRAMME\Boost\boost_1_33_1\tools\build\v2/kernel\modules.jam:259: in
import from module modules
C:\PROGRAMME\Boost\boost_1_33_1\tools\build\v2/kernel/bootstrap.jam:153: in
boost-build from module
c:\LC_TESTS\TTCN\ExtFuncLibs\test\boost-build.jam:3: in module scope from module
</bjam output>

Do I have to update BBv2 to a more recent version or am I doing something wrong
here?

Chris

P.S. Here is the code that exhibits above behavior:

src.jam:
########
import type ;
type.register SRC : src ;
type.register MY_CONVERTED_CPP : : CPP ;

actions convert {
    echo my_converter called with target: $(<) source: $(>)
}

import generators ;
import "class" : new ;

class my-src-generator : generator {

    import utility ;
    rule __init__ ( * : * )
    {
        generator.__init__ $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) :
$(8) : $(9) ;
        self.composing = true ;
    }
    rule generated-targets ( sources + : property-set : project name ? )
    {
        local a = [ new action $(sources) : src.convert : $(property-set) ] ;
        
        local targets ;
        for local s in $(sources)
        {
            targets += [ new file-target
                [ utility.basename [ $(s).name ] ]
                : CPP
                : $(project)
                : $(a) ] ;
        }
        return $(targets) ;
    }
}
generators.register [ new my-src-generator src.convert : SRC :
MY_CONVERTED_CPP ] ;

##################################################################
Jamroot:
########
import src ;
my-converted-cpp my_processed : a.src b.src ;
exe foo : my_processed ;


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