Boost logo

Boost-Build :

From: c_andy_martin (c_andy_martin_at_[hidden])
Date: 2004-11-15 14:38:37


OK. I've done that, and as I suspected, somehow the source files end
up with dependencies on the directory common/exception. I suspect it
has to do with the dependency scan somehow picking up #include
<exception> as pointing to the directory 'exception'. I will try to
include some of the relevant output (this is using the project
heirarchy from my original message which has a different subject line).

Output from bjam -d+12 (I have omitted portions with ...). This output
was taken after I had run bjam several times (so that no targets were
being updated). I then ran `touch common/exception' followed by `bjam
-d+12'.
-> 0 Name: all
: Updating it
: NOTFILE
: Depends on shell (stable)
: Depends on files (update) (max time)
: Depends on lib (stable)
: Depends on dll (update) (max time)
: Depends on exe (update) (max time)
: Depends on obj (update) (max time)
: Depends on first (stable)
...
-> 1 Name: files
: Updating it
: NOTFILE
: Depends on first (stable)
: Depends on <@proj!bin!stage-dir>libcommon-debug.so
(update) (max time)
: Depends on <@proj!bin!stage-dir>libcommon-debug.so.1.32.0
(stable)
: Depends on <@proj!bin!stage-dir>libcommon-release.so
(update) (max time)
: Depends on
<@proj!bin!stage-dir>libcommon-release.so.1.32.0 (stable)
: Depends on <@proj!bin!stage-dir>main-debug (update) (max time)
: Depends on <@proj!bin!stage-dir>main-release (update) (max
time)
-> 2 Name: <@proj!bin!stage-dir>libcommon-debug.so
Loc: bin/stage-dir/libcommon-debug.so
: Updating it
: Depends on <directory-grist>bin/stage-dir (stable)
: Depends on
<@proj!common/libcommon.so/gcc/debug/shared-linkable-true>libcommon-debug.so
(update) (max time)
...
-> 3 Name:
<@proj!common/libcommon.so/gcc/debug/shared-linkable-true>libcommon-debug.so
Loc:
bin/proj/common/libcommon.so/gcc/debug/shared-linkable-true/libcommon-debug.so
: Updating it
: Depends on
<directory-grist>bin/proj/common/libcommon.so/gcc/debug/shared-linkable-true
(stable)
: Depends on
<@proj!common/libcommon.so/gcc/debug/shared-linkable-true>test.o (old)
(max time)
: Depends on
<@proj!common/libcommon.so/gcc/debug/shared-linkable-true>Exception.o
(old) (max time)
: Depends on
<@proj!common/libcommon.so/gcc/debug/shared-linkable-true>xml_a.o
(old) (max time)
: Depends on
<@proj!common/libcommon.so/gcc/debug/shared-linkable-true>xml_b.o
(old) (max time)
: Depends on
<@proj!common/libcommon.so/gcc/debug/shared-linkable-true>libcommon-debug.so.1.32.0
(stable)
...
-> 4 Name:
<@proj!common/libcommon.so/gcc/debug/shared-linkable-true>test.o
Loc:
bin/proj/common/libcommon.so/gcc/debug/shared-linkable-true/test.o
: Outdated, updating it
: Depends on
<directory-grist>bin/proj/common/libcommon.so/gcc/debug/shared-linkable-true
(stable)
: Depends on <@proj!common>test/test.cpp (stable)
: Depends on
<directory-grist>bin/proj/common/libcommon.so/gcc/debug/shared-linkable-true
(stable)
: Depends on <@proj!common>test/test.cpp (internal node)
(stable) (max time)
...
5 Name: <@proj!common>test/test.cpp (internal node)
: Stable
: NOTFILE
: Depends on
<@proj!common#/usr/home/andy/work/code/vi-boost-interaction/common>test/test.h
(stable)
: Depends on
<@proj!common#/usr/home/andy/work/code/vi-boost-interaction/common>xml/xml_a.h
(stable)
: Depends on
<@proj!common#/usr/home/andy/work/code/vi-boost-interaction/common>test/test.h
(internal node) (stable) (max time)
: Depends on
<@proj!common#/usr/home/andy/work/code/vi-boost-interaction/common>xml/xml_a.h
(internal node) (stable) (max time)
...
6 Name:
<@proj!common#/usr/home/andy/work/code/vi-boost-interaction/common>test/test.h
(internal node)
: Stable
: NOTFILE
: Depends on
<@proj!common#/usr/home/andy/work/code/vi-boost-interaction/common>exception/Exception.h
(stable)
: Depends on
<@proj!common#/usr/home/andy/work/code/vi-boost-interaction/common>exception/Exception.h
(internal node) (stable) (max time)
7 Name:
<@proj!common#/usr/home/andy/work/code/vi-boost-interaction/common>exception/Exception.h
Loc:
/usr/home/andy/work/code/vi-boost-interaction/common/exception/Exception.h
: Stable
: NOCARE
7 Name:
<@proj!common#/usr/home/andy/work/code/vi-boost-interaction/common>exception/Exception.h
(internal node)
: Stable
: NOTFILE
: Depends on
<@proj!common#/usr/home/andy/work/code/vi-boost-interaction/common>exception
(newer) (max time)
: Depends on
<@proj!common#/usr/home/andy/work/code/vi-boost-interaction/common>string
(stable)
8 Name:
<@proj!common#/usr/home/andy/work/code/vi-boost-interaction/common>exception
Loc:
/usr/home/andy/work/code/vi-boost-interaction/common/exception
: Newer
: NOCARE
...

Here again is the output of `tree':
.
|-- Jamfile
|-- Jamrules
|-- boost-build.jam
|-- common
| |-- Jamfile
| |-- exception
| | |-- Exception.cpp
| | `-- Exception.h
| |-- test
| | |-- test.cpp
| | `-- test.h
| `-- xml
| |-- xml_a.cpp
| |-- xml_a.h
| |-- xml_b.cpp
| `-- xml_b.h
`-- main
|-- Jamfile
`-- main.cpp

And, the relevant jamfiles:

Jamrules:
# declare the project
project proj ;

# declare the project path
path-global PROJ_ROOT : . ;

# delcare BOOST_ROOT variable to point to our default boost install
path-global BOOST_ROOT : ../boost/boost_root ;

# setup the boost project
project boost : $(BOOST_ROOT) ;

# build the both debug and release builds by default
BUILD ?= debug release ;

# add '.' and './bin' to the run-time search path, and export all symbols
CUSTOM_LINKFLAGS ?= "-Wl,-rpath,. -Wl,-rpath,./bin -Wl,-E" ;
CUSTOM_DEFINES += _REENTRANT ;

Jamfile:

project-root ;

template myproj-base
:
: <sysinclude>@boost/
<linkflags>$(CUSTOM_LINKFLAGS)
<include>common
<define>$(CUSTOM_DEFINES)

template myproj-base-exe
: <template>myproj-base
<dll>$(PROJ_ROOT)/common/common
;

subinclude common main ;

install-subinclude common main ;

stage bin/stage-dir
:
[ install-sources dll ]
[ install-sources exe ]
:
<release><tag>-release
<debug><tag>-debug
:
debug release
;

common/Jamfile:
# this is the common library sub-project
subproject common ;

# build python extension modules as dynamic library
dll common
: # sources
test/test.cpp
exception/Exception.cpp
xml/xml_a.cpp
xml/xml_b.cpp
<template>@proj/myproj-base
: # requirements
;

install common dll
: <dll>common
;

main/Jamfile:
subproject main ;

# build the main executable
exe main
: # sources
main.cpp
<template>@proj/myproj-base-exe
:
;

install main exe
: <exe>main
;

And, the source for common/exception/Exception.h (which is included by
all other files directly or indirectly in the project):
#ifndef __EXCEPTION_INTERNAL_H
#define __EXCEPTION_INTERNAL_H

#include <exception>
#include <string>

typedef std::exception BaseException;
class Exception : public BaseException
{
public:
Exception( const char * s );
Exception( const std::string & s );
virtual ~Exception( ) throw();
virtual const char * what() const throw();

protected:
std::string description;
};
#endif

What first tipped me off to this behavior was running `vi' in the
exception directory always triggered a complete rebuild. This is
becuase `vi' deposited a .swp file in the exception directory, which
causes the directory's timestamp to be newer than the source,
triggereing a rebuild. That's why the project is in the directory
`vi-boost-interaction' because I was trying to figure out why vi would
cause things to rebuild.

Thanks for your help!!!
-Andy

--- In jamboost_at_[hidden], David Abrahams <dave_at_b...> wrote:
> I'm familiar enough with the source to know that it shouldn't be
> happening. Header and directory targets with the same names should be
> gristed to distinguish them from one another. I suggest you do
>
> bjam -d+12
>
> to see how the targets are getting identified.
>
> --
> Dave Abrahams
> Boost Consulting
> http://www.boost-consulting.com

 


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