Boost logo

Boost-Build :

Subject: Re: [Boost-build] error: Duplicate name of actual target
From: Grigory Simonyan (gsimonyan_at_[hidden])
Date: 2008-10-02 14:05:28


Volodya, Hi. Thank you for quick response!

Seems like I have found some "workaround" but it's very strange and the
problem still needs a correct solution.
Please find all the data used in my tests below:

1. I have a simple project (no other project references this project, it's
completely standalone) consisting of two cpp files: TestFS.cpp, TestFS1.cpp:

////////////////////////////////////////////////////////////////////////////
////
// TestFS.cpp

#include<iostream>
#include<boost/filesystem/operations.hpp>

int main()
{
    boost::filesystem::path p("some.file");
    // some usage of p
    return 0;
}

////////////////////////////////////////////////////////////////////////////
////
// TestFS1.cpp

int foo()
{
    return 0;
}

////////////////////////////////////////////////////////////////////////////
////

2. This is Jamfile used to build the project:

############################################################################
####
lib MyTestLib
    : TestFS1.cpp
    ;

exe MyTest
    : TestFS.cpp
      $(BOOST_PATH)/libs/filesystem/build//boost_filesystem/<link>static
      MyTestLib
    ;

install . : MyTest ;
############################################################################
####

3. And here is the build output:

suse103:/projects/ivr/TestFS # bjam
warning: Graph library does not contain optional GraphML reader.
note: to enable GraphML support, set EXPAT_INCLUDE and EXPAT_LIBPATH to the
note: directories containing the Expat headers and libraries, respectively.
warning: skipping optional Message Passing Interface (MPI) library.
note: to enable MPI support, add "using mpi ;" to user-config.jam.
note: to suppress this message, pass "--without-mpi" to bjam.
note: otherwise, you can safely ignore this message.
/projects/boost/tools/build/v2/build/virtual-target.jam:1032: in
virtual-target.register-actual-name from module virtual-target
error: Duplicate name of actual target:
<p/projects/ivr/build/TestFS/gcc-4.2.1/debug/threading-multi>TestFS.o
error: previous virtual target { gcc%gcc.compile.c++-TestFS.o.OBJ {
TestFS.cpp.CPP } }
error: created from ./MyTest
error: another virtual target { gcc%gcc.compile.c++-TestFS.o.OBJ {
TestFS.cpp.CPP } }
error: created from ./MyTest
error: added properties: <python-debugging>off <python>2.5
<threadapi>pthread
error: removed properties: none
/projects/boost/tools/build/v2/build/virtual-target.jam:468: in
actualize-no-scanner from module object(file-target)@535
/projects/boost/tools/build/v2/build/virtual-target.jam:123: in
object(file-target)@535.actualize from module object(file-target)@535
/projects/boost/tools/build/v2/build/virtual-target.jam:766: in
actualize-source-type from module object(action)@545
/projects/boost/tools/build/v2/build/virtual-target.jam:787: in
actualize-sources from module object(action)@545
/projects/boost/tools/build/v2/build/virtual-target.jam:728: in
object(action)@545.actualize from module object(action)@545
/projects/boost/tools/build/v2/build/virtual-target.jam:289: in
actualize-action from module object(file-target)@546
/projects/boost/tools/build/v2/build/virtual-target.jam:477: in
actualize-no-scanner from module object(file-target)@546
/projects/boost/tools/build/v2/build/virtual-target.jam:123: in
object(file-target)@546.actualize from module object(file-target)@546
/projects/boost/tools/build/v2/build-system.jam:681: in load from module
build-system
/projects/boost/tools/build/v2/kernel/modules.jam:281: in import from module
modules
/projects/boost/tools/build/v2/kernel/bootstrap.jam:128: in boost-build from
module
/projects/ivr/boost-build.jam:1: in module scope from module

But, if I swap two library lines in the exe target of the Jamfile:

############################################################################
####
lib MyTestLib
    : TestFS1.cpp
    ;

exe MyTest
    : TestFS.cpp
      MyTestLib
      $(BOOST_PATH)/libs/filesystem/build//boost_filesystem/<link>static
    ;

install . : MyTest ;
############################################################################
####

, build succeeds:

suse103:/projects/ivr/TestFS # bjam
warning: Graph library does not contain optional GraphML reader.
note: to enable GraphML support, set EXPAT_INCLUDE and EXPAT_LIBPATH to the
note: directories containing the Expat headers and libraries, respectively.
warning: skipping optional Message Passing Interface (MPI) library.
note: to enable MPI support, add "using mpi ;" to user-config.jam.
note: to suppress this message, pass "--without-mpi" to bjam.
note: otherwise, you can safely ignore this message.
...patience...
...found 456 targets...
...updating 33 targets...
MkDir1-quick-fix-for-unix /projects/ivr/build
MkDir1-quick-fix-for-unix /projects/ivr/build/TestFS
MkDir1-quick-fix-for-unix /projects/ivr/build/TestFS/gcc-4.2.1
MkDir1-quick-fix-for-unix /projects/ivr/build/TestFS/gcc-4.2.1/debug
MkDir1-quick-fix-for-unix
/projects/ivr/build/TestFS/gcc-4.2.1/debug/threading-multi
gcc.compile.c++
/projects/ivr/build/TestFS/gcc-4.2.1/debug/threading-multi/TestFS.o
gcc.compile.c++
/projects/ivr/build/TestFS/gcc-4.2.1/debug/threading-multi/TestFS1.o
gcc.link.dll
/projects/ivr/build/TestFS/gcc-4.2.1/debug/threading-multi/libMyTestLib.so
MkDir1-quick-fix-for-unix /projects/boost/bin.v2
MkDir1-quick-fix-for-unix /projects/boost/bin.v2/libs
MkDir1-quick-fix-for-unix /projects/boost/bin.v2/libs/filesystem
MkDir1-quick-fix-for-unix /projects/boost/bin.v2/libs/filesystem/build
MkDir1-quick-fix-for-unix
/projects/boost/bin.v2/libs/filesystem/build/gcc-4.2.1
MkDir1-quick-fix-for-unix
/projects/boost/bin.v2/libs/filesystem/build/gcc-4.2.1/debug
MkDir1-quick-fix-for-unix
/projects/boost/bin.v2/libs/filesystem/build/gcc-4.2.1/debug/link-static
MkDir1-quick-fix-for-unix
/projects/boost/bin.v2/libs/filesystem/build/gcc-4.2.1/debug/link-static/thr
eading-multi
...

4. This is my Jamroot file:

############################################################################
####
import os ;
path-constant BOOST_PATH : [ os.environ BOOST_PATH ] ;
path-constant TOP : . ;

project
        : requirements <include>$(BOOST_PATH) <threading>multi
        : build-dir /$(TOP)/build
    ;
############################################################################
####

5. This is my boost-build.jam:

############################################################################
####
boost-build $(BOOST_PATH)/tools/build/v2 ;
############################################################################
####

Please, note, that MyTestLib is just a dummy target used as "workaround",
enabling to build main target: MyTest.

Indeed, I'd like to have such Jamfile:
############################################################################
####
exe MyTest
    : TestFS.cpp
      $(BOOST_PATH)/libs/filesystem/build//boost_filesystem/<link>static
    ;

install . : MyTest ;
############################################################################
####
which cannot be used to build the project now.

Grigory.

-----Original Message-----
From: Vladimir Prus [mailto:ghost_at_[hidden]]
Sent: Thursday, October 02, 2008 5:50 PM
To: boost-build_at_[hidden]
Cc: Grigory Simonyan
Subject: Re: [Boost-build] error: Duplicate name of actual target

On Thursday 02 October 2008 15:28:54 Grigory Simonyan wrote:

> /projects/boost_1_36_0/tools/build/v2/build/virtual-target.jam:1032: in
> virtual-target.register-actual-name from module virtual-target
>
> error: Duplicate name of actual target:
>
<p/projects/ivr/build/TimerTest/gcc-4.2.1/debug/threading-multi>TimerTest.o
>
> error: previous virtual target { gcc%gcc.compile.c++-TimerTest.o.OBJ {
> TimerTest.cpp.CPP } }
>
> error: created from ./TimerTest
>
> error: another virtual target { gcc%gcc.compile.c++-TimerTest.o.OBJ {
> TimerTest.cpp.CPP } }
>
> error: created from ./TimerTest
>
> error: added properties: <python-debugging>off <python>2.5
> <threadapi>pthread

Well, it means your target is built twice, with different properties, and of
course
we cannot install two binaries named TimerTest into ".".

I don't know why this is happening, because you did not told everything
about your
setup. In particular, you provide Jamfile -- where's Jamroot? What other
project
refer to this TimerTest target?

- Volodya


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