Boost logo

Boost :

From: Stephen Nuchia (snuchia_at_[hidden])
Date: 2008-06-25 06:30:12


> 2. Please get someone to tell me the answer to the question that you
> want the guide to answer ;-)

I've found that you need
--toolset=msvc msvc/architecture=x86/address-model=64

But I'm still having a great deal of trouble finding a command line that
works reliably. I got everything built once but trying to build it
again from inside my Visual Studio "solution" is going badly.
Static/static works but most combinations of link and runtime-link
involving at least one "shared" are failing with duplicate target
errors. I'm trying to build --with-regex and --with-test; I've tried
one command line and one per lib/link/runtime-link combination with no
luck. I have found an intermediate set of notes but not my final notes
from my previous go-round with bjam. Sigh.

There are add-on tools, Compuware's Devpartner for instance, that when
active want to rebuild all the code in a program that isn't part of a
system library. Also, optimization choices like _SECURE_SCL, WPO/PGO,
and omit_frame_pointer work better when you build custom support
libraries to match the choices. This is a nightmare without automation.

After quite a bit of messing around with it, writing the infrastructure
to translate the settings from Visual Studio's build engine into bjam
command line parameters, I'm leaning toward writing visual studio
project files for the two precompiled libraries we depend on. It is a
more maintenance-intensive solution in the long run but it might
actually work. Bjam might too but that's apparently a matter of luck.
Well, cargo-cult programming and luck.

The "build" command of my "Makefile"-type project is (manually
line-wrapped):
for /F "tokens=1-3" %%i in (configs.txt) do (
        echo building %%i %%j %%k
        bjam --toolset=msvc-9.0 --build-dir="$(OutDir)boost" --with-%%i
msvc/architecture=$(PlatformArch)/address-
model=$(PlatformBitness)/link=%%j/runtime-link=%%k
define=_SECURE_SCL=$(SecureSCLValue) -d0 $(BoostConfiguration)
                stage
)

The "rebuild" line is the same but add -a, the "clean" line is the same
but add clean. Use the ... button at that shows up when you click in
the command line text box to pop up a multiline script editing window.
Join the bjam command text onto one line, no space before model. Use
copy-and-paste with "All Configurations" and "All Platforms" selected to
populate the rebuild and clean command lines, then edit each to add the
modifiers.

The boost.vcproj file is located in the root of the boost source tree
and configs.txt, in the same directory, contains:
regex static static
regex shared shared
regex static shared
test shared shared

The boost Makefile project inherits, in each Debug/Release cross-product
Win32/x64 configuration, from a .vsprops (property sheet) file named for
the configuration: e.g. Debug-Win32.vsprops. You set that up using the
Property Manager window; there's apparently no way to do so using the
regular property editing dialog for a Makefile project. In the property
sheets define the PlatformBitness, etc macros appropriately.

Like I said, the above isn't working completely, but it is as close as
I've managed to come so far to what I need.

Macro values in the .vsprops files should be:
PlatformArch: x86 or ia64 (Itanium)
PlatformBitness 32 or 64
SecureSCLValue 0 or 1 (always 1 for debug builds)
BoostConfiguration debug or release (lower-case of $(ConfigurationName))

Here's the build log for one of the failing combinations. The 1> is the
thread identifier added by the Visual Studio build engine running in
multithreaded mode:

1>building test shared shared
1>c:/code/Version 9/boost/tools/build/v2/build\virtual-target.jam:996:
in virtual-target.register-actual-name from module virtual-target
1>error: Duplicate name of actual target:
<pstage\lib>boost_prg_exec_monitor-vc90-mt-1_35.dll
1>error: previous virtual target {
common%common.copy-boost_prg_exec_monitor-vc90-mt-1_35.dll.SHARED_LIB {
msvc%msvc.link.dll-boost_prg_exec_monitor-vc90-mt-1_35.dll.SHARED_LIB {
msvc%msvc.compile.c++-execution_monitor.obj.OBJ {
execution_monitor.cpp.CPP } } { msvc%msvc.compile.c++-debug.obj.OBJ {
debug.cpp.CPP } } { msvc%msvc.compile.c++-cpp_main.obj.OBJ {
cpp_main.cpp.CPP } } } }
1>error: created from ./stage-proper
1>error: another virtual target {
common%common.copy-boost_prg_exec_monitor-vc90-mt-1_35.dll.SHARED_LIB {
msvc%msvc.link.dll-boost_prg_exec_monitor-vc90-mt-1_35.dll.SHARED_LIB {
msvc%msvc.compile.c++-execution_monitor.obj.OBJ {
execution_monitor.cpp.CPP } } { msvc%msvc.compile.c++-debug.obj.OBJ {
debug.cpp.CPP } } { msvc%msvc.compile.c++-cpp_main.obj.OBJ {
cpp_main.cpp.CPP } } } }
1>error: created from ./stage-proper
1>error: added properties: none
1>error: removed properties: <address-model>32 <architecture>x86
1>c:/code/Version 9/boost/tools/build/v2/build\virtual-target.jam:453:
in actualize-no-scanner from module object(file-target)@695
1>c:/code/Version 9/boost/tools/build/v2/build\virtual-target.jam:118:
in object(file-target)@695.actualize from module object(file-target)@695
1>c:/code/Version 9/boost/tools/build/v2\build-system.jam:675: in load
from module build-system
1>c:\code\Version 9\boost\tools\build\v2/kernel\modules.jam:267: in
import from module modules
1>c:\code\Version 9\boost\tools\build\v2/kernel/bootstrap.jam:132: in
boost-build from module
1>c:\code\Version 9\boost\boost-build.jam:11: in module scope from
module
1>Project : error PRJ0019: A tool returned an error code from
"Performing Makefile project actions"


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk