Building boost with different gcc version
Asked Answered
B

4

27

I have access to server where I need to build boost 1.46. How can I force bootstrap.sh to use /usr/bin/gcc-4.4. By default it uses /usr/bin/gcc and I can't figure out how to change this

Baldwin answered 17/3, 2011 at 23:19 Comment(0)
B
44

I cross built Boost for an ARM toolchain using something like this:

echo "using gcc : arm-unknown-linux-gnueabi : /usr/local/arm/bin/g++ ; " >> tools/build/v2/user-config.jam

You should be able to do something like this:

boost version 1.59 and above:

echo "using gcc : 4.4 : /usr/bin/g++-4.4 ; " >> tools/build/src/user-config.jam

boost version 1.58 and below:

echo "using gcc : 4.4 : /usr/bin/g++-4.4 ; " >> tools/build/v2/user-config.jam

and then build with

bjam --toolset=gcc-4.4
Bridoon answered 17/3, 2011 at 23:31 Comment(5)
Another confirmation: Linux Mint 17.1, x64, GCC-4.1, Boost 1.43Karykaryl
You may need a ./ on ./bjam if you're building locally and you already have a system installation of Boost.Loomis
Why bjam rather than b2?Envoy
BTW: Be care for the space! missing space gives an error!Yip
This implies that bjam somehow already exists.Zel
C
3

With the most recent version of Boost 1.71 works the below way:

>export CC=<path to custom gcc>/gcc
>export CXX=<path to custom gcc>/g++
>./bootstrap.sh
>./b2 --toolset=gcc stage threading=multi link=shared

You could check the gcc version used for build with bellow command

>ldd b2
    linux-vdso.so.1 =>  (0x00007ffcaa5f4000)
    libstdc++.so.6 => <path to custom gcc>/lib64/libstdc++.so.6 (0x00002b85ab701000)
    libm.so.6 => /lib64/libm.so.6 (0x00002b85abaaa000)
    libgcc_s.so.1 => <path to custom gcc>/lib64/libgcc_s.so.1 (0x00002b85abdac000)
    libc.so.6 => /lib64/libc.so.6 (0x00002b85abfc3000)
    /lib64/ld-linux-x86-64.so.2 (0x00002b85ab4dd000)

or in bin.v2/project-cache.jam file

Crunch answered 9/12, 2019 at 20:19 Comment(2)
only b2 is built with the specified gcc, not the boost libraryContravallation
both CC and CXX are ignored by ./bootstrap.shZel
T
2

Update for Boost 1.59

Now you need to do this:

echo "using gcc : : /usr/bin/g++44 ; " >> tools/build/src/user-config.jam
Tuberous answered 19/11, 2015 at 15:58 Comment(0)
L
1

For people who like to know the answer for Boost 1.61 on OSX 10.11.6: Sean's answer did not work for me because of the ld: unknown option: -h error mentioned in this boost report. To make it work I replaced gcc by darwin in his command

echo "using darwin : 6.2 : /usr/local/bin/g++-6 ; " >> tools/build/src/user-config.jam

To compile and install it I used

./b2 --toolset=darwin-6.2 --prefix=$HOME/.local/ install
Lutetium answered 30/8, 2016 at 14:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.