
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

I have successfully done this by doing the following: 1. export CC, CXX etc (to be location of custom gcc) 2. edit user-config.jam (specifying location of custom gcc) 3. run bootstrap 4. run b2 (specifying toolset=gcc) Please excuse the variables I have in the following examples but I've taken this from some scripts we have for our own in-house sdk. I think you should be able to get the gist: export AR="${GCC_LOC}/ar" export CC="${GCC_LOC}/gcc" export CPP="${GCC_LOC}/gcc -E" export CXX="${GCC_LOC}/g++" export CXXCPP="${GCC_LOC}/g++ -E" pushd boost_${BOOST_DL_VERSION} > /dev/null # add our compiler to the end of the boost jam config file cat <<EOF > ./tools/build/v2/user-config.jam using gcc : : ${GCC_LOC}/g++ ; EOF BOOST_LIBRARIES=filesystem,python,regex,system CONFIGURE_OPTIONS="--with-python-version=2.7 --with-python-root=${PYTHON_LOC}/${OS}/${ARCH} --with-python=${PYTHON_LOC}/${OS}/${ARCH}/bin/python" ./bootstrap.sh --prefix=${PREFIX} --with-libraries=${BOOST_LIBRARIES} ${CONFIGURE_OPTIONS} ./b2 $CPPFLAGS --toolset=gcc

Thanks a lot Steve. I tried your exact same instructions and this is my output. Please note that I am using boost_1_51_0. 1. I exported the environment variables and changed the user-config.jam as you had mentioned. 2. I ran *./bootstrap.sh --prefix=INSTALL_DIR* Here is the output on the console and in bootstrap.log *Console* : No toolset specified. Please use --toolset option Bootstrapping is done. To build, run: cp: cannot stat `./tools/build/v2/engine/###\n### cp: cannot stat `./tools/build/v2/engine/###\n### ./b2 *Bootstrap.log* - Using 'cc' toolset ...updating 3 targets... [MKDIR] bin.linuxx86_64 [COMPILE] bin.linuxx86_64/b2 [COPY] bin.linuxx86_64/bjam ...updated 3 targets... 3. However b2 and bjam got built in this location - tools/build/v2/engine/bin.linuxx86_64/b2 Setting export CPPFLAGS="cxxflags=-fPIC" and running ./tools/build/v2/engine/bin.linuxx86_64/b2 $CPPFLAGS --toolset=gcc gives the errors on console. project-config.jam:10: syntax error at keyword in project-config.jam:11: syntax error at keyword { project-config.jam:13: syntax error at keyword } project-config.jam:15: in load rule project unknown in module xsltproc /home/chinmay/3rdParty/boost_1_51_0/tools/build/v2/kernel/modules.jam:283: in modules.import /home/chinmay/3rdParty/boost_1_51_0/tools/build/v2/build/project.jam:917: in import Jamroot:130: in modules.load /home/chinmay/3rdParty/boost_1_51_0/tools/build/v2/build/project.jam:317: in load-jamfile /home/chinmay/3rdParty/boost_1_51_0/tools/build/v2/build/project.jam:62: in load /home/chinmay/3rdParty/boost_1_51_0/tools/build/v2/build/project.jam:168: in project.find /home/chinmay/3rdParty/boost_1_51_0/tools/build/v2/build-system.jam:570: in load /home/chinmay/3rdParty/boost_1_51_0/tools/build/v2/kernel/modules.jam:283: in import /home/chinmay/3rdParty/boost_1_51_0/tools/build/v2/kernel/bootstrap.jam:142: in boost-build /home/chinmay/3rdParty/boost_1_51_0/boost-build.jam:17: in module scope These are the "erraneous" lines in project-config.jam. Would we have to change these too? # Compiler configuration. This definition will be used unless # you already have defined some toolsets in your user-config.jam # file. if ! in [ feature.values <toolset> ] { using ; } project : default-build <toolset> ; Thanks again, Arjun -- View this message in context: http://boost.2283326.n4.nabble.com/Building-boost-with-custom-gcc-g-tp464105... Sent from the Boost - Users mailing list archive at Nabble.com.

Hmm... it works for me I don't like the look of this: Bootstrapping is done. To build, run:
cp: cannot stat `./tools/build/v2/engine/###\n### cp: cannot stat `./tools/build/v2/engine/###\n### ./b2
Looks like you're using linux, on x86_64... which is what I'm using so I can't understand what's happening here, unless perhaps there is a problem with your gcc 4.7.2 installation? I searched for the ###\n### garbage on google, and got this: https://svn.boost.org/trac/boost/ticket/5880 Also found this stackoverflow question which may help: http://stackoverflow.com/questions/7240635/how-to-install-boost-on-linux-wit... Sorry I can't be of more help!

No probs Steve. What seems to be happening in my case is, it cannot find any gcc or any toolset in PATH. I am not sure if gcc should be in PATH. i.e if "which gcc" should give an output. It eventually defaults to cc toolset and it takes the environment variables CC in that case. (as shown in bootstrap.log) Could you just tell what do you get in your bootstrap.log? What is the toolset it seems to be using - is it taking from your custom gcc path / just whatever gcc it finds in "which gcc". Also what is the version of boost you have? Thanks again, Steve. -- View this message in context: http://boost.2283326.n4.nabble.com/Building-boost-with-custom-gcc-g-tp464105... Sent from the Boost - Users mailing list archive at Nabble.com.

On 8 January 2013 18:56, narjunkumar
What seems to be happening in my case is, it cannot find any gcc or any toolset in PATH. I am not sure if gcc should be in PATH. i.e if "which gcc" should give an output.
gcc via $PATH is the system gcc (version 4.3 or something I think); the gcc boost / b2 uses is the gcc in user_config.jam (this can be seen not from the bootstrap.log output; but from the output of b2) - I'm using 4.7.2 It eventually defaults to cc toolset and it takes the
environment variables CC in that case. (as shown in bootstrap.log)
Could you just tell what do you get in your bootstrap.log? What is the toolset it seems to be using - is it taking from your custom gcc path / just whatever gcc it finds in "which gcc". Also what is the version of boost you have?
Below is the log, I'm using 1.51 ### ### Using 'gcc' toolset. ### rm -rf bootstrap mkdir bootstrap gcc -o bootstrap/jam0 command.c compile.c constants.c debug.c function.c glob.c hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c object.c option.c output.c parse.c pathunix.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c pwd.c class.c native.c md5.c w32_getreg.c modules/set.c modules/path.c modules/regex.c modules/property-set.c modules/sequence.c modules/order.c execunix.c fileunix.c ./bootstrap/jam0 -f build.jam --toolset=gcc --toolset-root= clean ...found 1 target... ...updating 1 target... ...updated 1 target... ./bootstrap/jam0 -f build.jam --toolset=gcc --toolset-root= ...found 50 targets... ...updating 3 targets... [MKDIR] bin.linuxx86_64 [COMPILE] bin.linuxx86_64/b2 [COPY] bin.linuxx86_64/bjam ...updated 3 targets... --------------------- So I ripped out the relevant details from my scripts and ran them from the command line. The following, if I literally just copy-paste it to my linux command line, works. If it doesn't for you, then perhaps there is something wrong with your environment? Note you will obviously have to change the first few lines to specify your $PREFIX and your GCC 4.7.2 location Note also it relies on boost_1_51_0.tar.gz being in the current directory. --------------------- # this section you will have to change to correctly specify your $PREFIX and your compiler version/location export PREFIX=/hostname/trading/sdk/ export GLIBC_VER=`/lib/libc.so.6 | head -n1 | cut -f7 -d' '` export MACHINE_ARCH=`/bin/arch` export KERNEL_NAME=`uname -s | tr A-Z a-z` export GCCVER=gcc-4.7.2 export COMPDIR=${PREFIX}/${MACHINE_ARCH}/${GLIBC_VER}/${GCCVER}/bin # store current dir as the external build root dir export BUILD_DIR=`pwd` pushd $BUILD_DIR > /dev/null # override compiler env vars export AR="$COMPDIR/ar" export CC="$COMPDIR/gcc" export CPP="$COMPDIR/gcc -E" export CXX="$COMPDIR/g++" export CXXCPP="$COMPDIR/g++ -E" # boost version and where to get it export BOOST_VER=1.51.0 # this is for default and pic builds - here I show only the default (which will be for statically linked libs) export TARGET_BUILD_CONF=Def # create subdirectory for specific build configuration mkdir -p ${GCCVER}_${TARGET_BUILD_CONF} pushd ${GCCVER}_${TARGET_BUILD_CONF} > /dev/null # unpack source code tar -xf ../boost_${BOOST_DL_VERSION}.tar.gz pushd boost_${BOOST_DL_VERSION} # add your custom compiler to the end of the boost jam config file cat <<EOF > ./tools/build/v2/user-config.jam using gcc : : $COMPDIR/g++ ; EOF # bootstrap the build ./bootstrap.sh --prefix=${PREFIX} --with-libraries=filesystem,regex,system # build it ./b2 --toolset=gcc --------------------- The output from pasting the above to the command line is as follows: --------------------- $ ls -1 boost_1_51_0.tar.gz boost_1_51_0.tar.gz $ # this section you will have to change to correctly specify your $PREFIX and your compiler version/location $ export PREFIX=/hostname/trading/sdk/ $ export GLIBC_VER=`/lib/libc.so.6 | head -n1 | cut -f7 -d' '` $ export MACHINE_ARCH=`/bin/arch` $ export KERNEL_NAME=`uname -s | tr A-Z a-z` $ export GCCVER=gcc-4.7.2 $ export COMPDIR=${PREFIX}/${MACHINE_ARCH}/${GLIBC_VER}/${GCCVER}/bin $ $ # store current dir as the external build root dir $ export BUILD_DIR=`pwd` $ pushd $BUILD_DIR > /dev/null $ $ # override compiler env vars $ export AR="$COMPDIR/ar" $ export CC="$COMPDIR/gcc" $ export CPP="$COMPDIR/gcc -E" $ export CXX="$COMPDIR/g++" $ export CXXCPP="$COMPDIR/g++ -E" $ $ # boost version and where to get it $ export BOOST_VER=1.51.0 $ $ # this is for default and pic builds - here I show only the default (which will be for statically linked libs) $ export TARGET_BUILD_CONF=Def $ $ # create subdirectory for specific build configuration $ mkdir -p ${GCCVER}_${TARGET_BUILD_CONF} $ pushd ${GCCVER}_${TARGET_BUILD_CONF} > /dev/null $ $ # unpack source code $ tar -xf ../boost_${BOOST_DL_VERSION}.tar.gz $ $ pushd boost_${BOOST_DL_VERSION} ~/build.scripts/gcc-4.7.2_Def/boost_1_51_0 ~/build.scripts/gcc-4.7.2_Def ~/build.scripts ~/build.scripts ~/build.scripts ~/build.scripts ~/build.scripts/gcc-4.7.2_Def ~/build.scripts ~/build.scripts ~/build.scripts/gcc-4.7.2_Def ~/build.scripts ~/build.scripts ~/build.scripts/gcc-4.7.2_Def ~/build.scripts ~/build.scripts ~/build.scripts ~/build.scripts ~/build.scripts ~/build.scripts ~/build.scripts/gcc-4.7.2_Def ~/build.scripts ~/build.scripts ~/build.scripts ~/build.scripts ~/build.scripts ~/build.scripts $ $ # add your custom compiler to the end of the boost jam config file $ cat <<EOF > ./tools/build/v2/user-config.jam
using gcc : : $COMPDIR/g++ ; EOF $ $ # bootstrap the build $ ./bootstrap.sh --prefix=${PREFIX} --with-libraries=filesystem,regex,system Building Boost.Build engine with toolset gcc... tools/build/v2/engine/bin.linuxx86_64/b2 Unicode/ICU support for Boost.Regex?... not found. Generating Boost.Build configuration in project-config.jam...
Bootstrapping is done. To build, run: ./b2 To adjust configuration, edit 'project-config.jam'. Further information: - Command line help: ./b2 --help - Getting started guide: http://www.boost.org/more/getting_started/unix-variants.html - Boost.Build documentation: http://www.boost.org/boost-build2/doc/html/index.html $ $ # build it $ ./b2 --toolset=gcc Building the Boost C++ Libraries. Performing configuration checks - has_icu builds : no Component configuration: - chrono : not building - context : not building - date_time : not building - exception : not building - filesystem : building - graph : not building - graph_parallel : not building - iostreams : not building - locale : not building - math : not building - mpi : not building - program_options : not building - python : not building - random : not building - regex : building - serialization : not building - signals : not building - system : building - test : not building - thread : not building - timer : not building - wave : not building ...patience... ...found 676 targets... ...updating 90 targets... common.mkdir stage common.mkdir stage/lib common.mkdir bin.v2/libs/filesystem common.mkdir bin.v2/libs/filesystem/build common.mkdir bin.v2/libs/filesystem/build/gcc-4.7.2 common.mkdir bin.v2/libs/filesystem/build/gcc-4.7.2/release common.mkdir bin.v2/libs/filesystem/build/gcc-4.7.2/release/threading-multi gcc.compile.c++ bin.v2/libs/filesystem/build/gcc-4.7.2/release/threading-multi/codecvt_error_category.o gcc.compile.c++ bin.v2/libs/filesystem/build/gcc-4.7.2/release/threading-multi/operations.o gcc.compile.c++ bin.v2/libs/filesystem/build/gcc-4.7.2/release/threading-multi/path.o gcc.compile.c++ bin.v2/libs/filesystem/build/gcc-4.7.2/release/threading-multi/path_traits.o gcc.compile.c++ bin.v2/libs/filesystem/build/gcc-4.7.2/release/threading-multi/portability.o gcc.compile.c++ bin.v2/libs/filesystem/build/gcc-4.7.2/release/threading-multi/unique_path.o gcc.compile.c++ bin.v2/libs/filesystem/build/gcc-4.7.2/release/threading-multi/utf8_codecvt_facet.o gcc.compile.c++ bin.v2/libs/filesystem/build/gcc-4.7.2/release/threading-multi/windows_file_codecvt.o common.mkdir bin.v2/libs/system common.mkdir bin.v2/libs/system/build common.mkdir bin.v2/libs/system/build/gcc-4.7.2 common.mkdir bin.v2/libs/system/build/gcc-4.7.2/release common.mkdir bin.v2/libs/system/build/gcc-4.7.2/release/threading-multi gcc.compile.c++ bin.v2/libs/system/build/gcc-4.7.2/release/threading-multi/error_code.o gcc.link.dll bin.v2/libs/system/build/gcc-4.7.2/release/threading-multi/libboost_system.so.1.51.0 gcc.link.dll bin.v2/libs/filesystem/build/gcc-4.7.2/release/threading-multi/libboost_filesystem.so.1.51.0 common.copy stage/lib/libboost_filesystem.so.1.51.0 ln-UNIX stage/lib/libboost_filesystem.so common.mkdir bin.v2/libs/regex/build/gcc-4.7.2/release common.mkdir bin.v2/libs/regex/build/gcc-4.7.2/release/threading-multi gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/threading-multi/c_regex_traits.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/threading-multi/cpp_regex_traits.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/threading-multi/cregex.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/threading-multi/fileiter.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/threading-multi/icu.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/threading-multi/instances.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/threading-multi/posix_api.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/threading-multi/regex.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/threading-multi/regex_debug.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/threading-multi/regex_raw_buffer.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/threading-multi/regex_traits_defaults.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/threading-multi/static_mutex.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/threading-multi/w32_regex_traits.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/threading-multi/wc_regex_traits.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/threading-multi/wide_posix_api.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/threading-multi/winstances.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/threading-multi/usinstances.o gcc.link.dll bin.v2/libs/regex/build/gcc-4.7.2/release/threading-multi/libboost_regex.so.1.51.0 common.copy stage/lib/libboost_regex.so.1.51.0 ln-UNIX stage/lib/libboost_regex.so common.copy stage/lib/libboost_system.so.1.51.0 ln-UNIX stage/lib/libboost_system.so common.mkdir bin.v2/libs/system/build/gcc-4.7.2/release/link-static common.mkdir bin.v2/libs/system/build/gcc-4.7.2/release/link-static/threading-multi gcc.compile.c++ bin.v2/libs/system/build/gcc-4.7.2/release/link-static/threading-multi/error_code.o gcc.archive bin.v2/libs/system/build/gcc-4.7.2/release/link-static/threading-multi/libboost_system.a common.copy stage/lib/libboost_system.a common.mkdir bin.v2/libs/filesystem/build/gcc-4.7.2/release/link-static common.mkdir bin.v2/libs/filesystem/build/gcc-4.7.2/release/link-static/threading-multi gcc.compile.c++ bin.v2/libs/filesystem/build/gcc-4.7.2/release/link-static/threading-multi/codecvt_error_category.o gcc.compile.c++ bin.v2/libs/filesystem/build/gcc-4.7.2/release/link-static/threading-multi/operations.o gcc.compile.c++ bin.v2/libs/filesystem/build/gcc-4.7.2/release/link-static/threading-multi/path.o gcc.compile.c++ bin.v2/libs/filesystem/build/gcc-4.7.2/release/link-static/threading-multi/path_traits.o gcc.compile.c++ bin.v2/libs/filesystem/build/gcc-4.7.2/release/link-static/threading-multi/portability.o gcc.compile.c++ bin.v2/libs/filesystem/build/gcc-4.7.2/release/link-static/threading-multi/unique_path.o gcc.compile.c++ bin.v2/libs/filesystem/build/gcc-4.7.2/release/link-static/threading-multi/utf8_codecvt_facet.o gcc.compile.c++ bin.v2/libs/filesystem/build/gcc-4.7.2/release/link-static/threading-multi/windows_file_codecvt.o gcc.archive bin.v2/libs/filesystem/build/gcc-4.7.2/release/link-static/threading-multi/libboost_filesystem.a common.copy stage/lib/libboost_filesystem.a common.mkdir bin.v2/libs/regex/build/gcc-4.7.2/release/link-static common.mkdir bin.v2/libs/regex/build/gcc-4.7.2/release/link-static/threading-multi gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/link-static/threading-multi/c_regex_traits.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/link-static/threading-multi/cpp_regex_traits.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/link-static/threading-multi/cregex.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/link-static/threading-multi/fileiter.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/link-static/threading-multi/icu.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/link-static/threading-multi/instances.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/link-static/threading-multi/posix_api.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/link-static/threading-multi/regex.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/link-static/threading-multi/regex_debug.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/link-static/threading-multi/regex_raw_buffer.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/link-static/threading-multi/regex_traits_defaults.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/link-static/threading-multi/static_mutex.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/link-static/threading-multi/w32_regex_traits.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/link-static/threading-multi/wc_regex_traits.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/link-static/threading-multi/wide_posix_api.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/link-static/threading-multi/winstances.o gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.7.2/release/link-static/threading-multi/usinstances.o gcc.archive bin.v2/libs/regex/build/gcc-4.7.2/release/link-static/threading-multi/libboost_regex.a common.copy stage/lib/libboost_regex.a ...updated 90 targets... The Boost C++ Libraries were successfully built! The following directory should be added to compiler include paths: /home/sydapps/build.scripts/gcc-4.7.2_Def/boost_1_51_0 The following directory should be added to linker library paths: /home/sydapps/build.scripts/gcc-4.7.2_Def/boost_1_51_0/stage/lib $

Thanks a lot Steve (and others). I figured out that the problem is the initial bootstrap does not pick anything from user-config.jam for our custom compiler.. it's all hard-coded in there. So when no gcc is available in PATH, (my case) it shows these wierd errors. Also understood that doesnt matter what compiler you build bootstrap with. So I just ensure that my gcc is in PATH for bootstrap to succeed, then the 2nd step picks the custom gcc from the jam file correctly. I guess this solves it for me. However if you only have a custom compiler inside some folder with a name like gcc-4-5-mine , then I guess you might need to create an alias, or edit the build.sh file inside tools/build/engine/v2 as pointed out by the stack overflow qn. Thanks again. -- View this message in context: http://boost.2283326.n4.nabble.com/Building-boost-with-custom-gcc-g-tp464105... Sent from the Boost - Users mailing list archive at Nabble.com.

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@lists.boost.org 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
participants (4)
-
arjun
-
David P. Riedel
-
narjunkumar
-
Steve Lorimer