How do I build boost with Visual Studio 2008 when I have multiple Visual Studio versions installed?
Asked Answered
V

3

10

I know how to build boost with the latest visual studio on my machine (this question, for example)

However, I need to build the libs for Visual Studio 2008 (vc9)

I tried using toolset=vc9 but I get problems/no success.

How can I build the libs for vc9?

After I run boostrap I try running

b2 toolset=vc9

but the output is:

C:/Development/boost 50/boost_1_50_0/boost_1_50_0/tools/build/v2/build\toolset.jam:39: in toolset.using rule vc9.init unknown in module toolset

C:/Development/boost 50/boost_1_50_0/boost_1_50_0/tools/build/v2\build-system.jam:481: in process-explicit-toolset-requests

C:/Development/boost 50/boost_1_50_0/boost_1_50_0/tools/build/v2\build-system.jam:562: in load

C:\Development\boost 50\boost_1_50_0\boost_1_50_0\tools\build\v2/kernel\modules.jam:283: in import

C:\Development\boost 50\boost_1_50_0\boost_1_50_0\tools\build\v2/kernel/bootstrap.jam:142: in boost-build

C:\Development\boost 50\boost_1_50_0\boost_1_50_0\boost-build.jam:17: in module scope

Vellicate answered 2/8, 2012 at 20:6 Comment(0)
M
23

toolset=msvc-9.0

I have VS2008-Pro and VS2010-Express installed. The default ran with VS2010. Setting toolset=msvc-9.0 caused the build to run with VS2008. Using Boost 1.51.0.

Misshape answered 27/10, 2012 at 19:38 Comment(0)
M
0

You'll need to dig into the How-To-Build-Boost documentation, and in particular see this; but the part you need to specify a particular MSVC version is pointed to here. That suggests creating a user-config.jam, which probably would work, but I created a project-config.jam file instead.

Mcspadden answered 2/8, 2012 at 20:57 Comment(0)
V
0

I seem to be able to do this by running the top-level boost build (or meta build) script from different VC command lines. For example to build with VC2012, start a command line with vc 2012 vars. And for 2010, do the same. The automatically generated build scripts seem to do the right thing.

I am sure there are ways to do this by editing the build scripts myself or by setting the toolset, but I had no success with that.

Vellicate answered 28/10, 2012 at 1:25 Comment(1)
This is exactly what I would have expected - if I try to build boost with the vs2008 command line, I want the vs2008 compiler and build environment. And boost doesn't do this - it goes ahead and chooses vs2010. The build system should be referentially transparent. What boost is doing - fishing around for global system settings - is just about the worst thing they could do.Superstitious

© 2022 - 2024 — McMap. All rights reserved.