Boost logo

Boost Users :

Subject: Re: [Boost-users] Building boost with custom gcc/g++
From: David P. Riedel (driedel_at_[hidden])
Date: 2013-01-08 09:38:45


On 01/07/2013 07:37 AM, arjun wrote:
> Hi,
>
> I have issues in getting boost to build with a custom gcc installation
> in a separate folder, with default gcc in /usr/bin/.
> Describing the problem, and issues I am facing below. I would love to
> have a foolproof and right way to do this. I hope I can
> get some help here.
>
> Building boost with a custom compiler :
>
> Problem :
>
> 1. I have gcc/g++ in /usr/bin, and I have gcc 4.7.2 in
> /shared/tools/rtf/bin/gcc & /shared/tools/rtf/bin/g++
>
> 2. I want to compile boost libraries using gcc 4.7.2 ONLY.
>
> Solutions :
>
> 1. If I export PATH as /shared/tools/rtf/bin:$PATH, so that "which gcc"
> picks the 4.7.2 one, then I run ./bootstrap.sh and ./b2 install, is that
> a correct way to do it?
>
> 2. Alternatively, would I have to change some .jam files like
> user-config.jam to point out gcc with using gcc : gcc-4.4 :
> /shared/tools/... gcc
> and then compile using Boost.build? Is this the recommended way?
>
> Issues/Confusions :
>
> 1. If I try to build using Boost.build way I first go to the directory
> tools/build/v2. Now 1st step to bootstrap, how to bootstrap it with
> /shared/tools/...gcc compiler?
>
> The only way I saw for that was to do like
> CC=/shared/tools/..gcc ./bootstrap.sh --with-toolset=cc
> as this actually picks from CC environment variable. Is this correct?
>
> 2. The subsequent step
> ./b2 install --prefix=INSTALL_PATH to build Boost.build fails saying
> cc.jam not present. How to get that jam file to be present? Should that
> be created
> manually?
>
> 3. I had also changed user-config.jam to have gcc-4.7 (using gcc : 4.7 :
> /shared/tools/..gcc).
>
> CC=/shared/tools/..gcc ./bootstrap.sh --with-toolset=cc toolset=gcc-4.7
>
> Is this used during bootstrap.sh step? Or only when we give the actual
> boost build (running b2)
>
> 4. Another issue was when I run the bootstrap.sh inside tools/build/v2
> (to get Boost.build built), If I give a --with-toolset option, I get the
> b2 and bjam executables
> in the current directory. If I do not give a with-toolset option, it
> automatically defaults to cc, in which case the b2,bjam are inside
> engine/bin.linux86_64 folder.
> Not able to understand this.
>
> Thanks,
> Arjun
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

I have several different versions of gcc I need to work with so,
I have done this for a long time by modifying my user-config.jam as follows:
using gcc : : /<path to custom gcc>/bin/g++ : <linkflags>"-Wl,-rpath
-Wl,/<path to custom gcc>/lib64" ;

You need the rpath so that any shared libraries will find the correct
gcc runtime libraries.

HTH.

Dave Riedel


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net