Boost logo

Boost Users :

Subject: Re: [Boost-users] How do I build libraries with binaries using two versions of the same toolset
From: Ted Byers (r.ted.byers_at_[hidden])
Date: 2013-12-11 15:36:26

Hi Steven,,


On Wednesday, December 11, 2013 11:52:08 AM Steven Watanabe wrote:
AMDG? What is that?

> On 12/11/2013 11:25 AM, Ted Byers wrote:
> > On my OpenSuse box, version 12.3, the default version of gcc is 4.7.
> > I just successfully built gcc 4.8.2, with the binary names ending with
> > 48 (so I have gcc48, g++48, &c.). So, I have two versions of gcc on
> > this machine, and I believe I can use either by setting CC to the one
> > or the other in my make files.
> >
> > Hence my problem. I have built boost 1.55.0 on my Ubuntu 12.04 box
> > (but with the default names, so that gcc -v tells me that I am using
> > gcc 4.8.2: the default version of gcc on that version of Ubuntu is
> > 4.6, which is too old for me to consider). So, a basic build of the
> > boost libraries is simple, and something I have done before. But I do
> > not know how to build boost twice, once with gcc 4.7 and once with gcc
> > 4.8.2, and have them installed in such a way as to ensure that the two
> > builds do not clash and so that if I set CC to the one or the other
> > version of gcc, the right build of boost will automagically be
> > selected (it would be appreciated if someone who knows Gnu make better
> > than I do could show me how to effect that in my makefiles).
> > Obviously I am assuming that a single build of boost will not work
> > with both compilers (is that assumption correct?).
> It's possible that it would work, but
> I wouldn't count on it. We don't do
> anything to ensure it.

I tend to be a bit paranoid, and so would begin with the assumption that it
would not, unless someone with a lot more experience than I could demonstrate
that it would. I'd agree that it is possible, but I wouldn't bet the farm on
it; hence my inclincation to assume it wouldn't.

> > Unfortunately, I
> >
> > have not yet found anything in the documentation that talks about
> > building boost with different versions of a given toolset on the same
> > machine.
> The only problem is that the final libraries have the same name.
> You can either use --layout=tagged or --layout=versioned
> to include the toolset in the library name, or you
> can use --stagedir=xxx to install the libraries into
> two different directories.
Actually, there are two problems. One is that the libraries would have the
same names, as you point out, and the solution to that is to install the
libraries into two different directories. The other is how to tell b2 to use
gcc 4.7 for the first build and to use gcc 4.8.2 for the other.

Can I trouble you to explain staging, as it exists in building boost, a bit
more fully? I thought staging referred to putting the libraries into a
temporary directory, while being built and tested, and then, only if the tests
all pass, do they get installed into their final destination. I would assume
that, by default, the headers would be installed to /usr/local/include/boost,
and that the library binaries would be installed to /usr/local/lib/boost, and
normal practice would be to have a temporary staging directory within my home
directory (and safely disposed of after installation). Is that not right?



> In Christ,
> Steven Watanabe
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at