29

I have RHEL 5.2, with Boost 1.33 installed. I downloaded boost_1_44_0.tar.bz2. and built it. On completion it showed:

The Boost C++ Libraries were successfully built!

The following directory should be added to compiler include paths:

    /home/dfe/Archive/boost_1_44_0

The following directory should be added to linker library paths:

    /home/dfe/Archive/boost_1_44_0/stage/lib
  1. How do I add the above mentioned include paths?
  2. When I do "rpm -q boost", it shows boost-1.33.1-10.el5. Why is that so, when I've installed version 1.44?
  3. Is there a better way to install the latest version of Boost?
Nav
  • 19,885
  • 27
  • 92
  • 135

4 Answers4

25

There are always three steps to install software on Linux systems:

  1. configure — "check"
  2. make — "build software in current directory"
  3. make install — "copy files to the systems so the other software can use this software"

You likely did the equivalent of make but did not do the equivalent of make install. You need to run

sudo ./b2 install

after running ./b2

Phrogz
  • 296,393
  • 112
  • 651
  • 745
user2716834
  • 251
  • 1
  • 3
  • 2
15

Just add the paths to your .bashrc or .profile (or whatever floats your boat) like this:

export LIBS="-L/home/dfe/Archive/boost_1_44_0/stage/lib"
export CPPFLAGS="-I/home/dfe/Archive/boost_1_44_0"
isomorphismes
  • 8,233
  • 9
  • 59
  • 70
der_michael
  • 3,151
  • 1
  • 24
  • 43
11

You have to include these directories into makefile which you would use to build your application

CC -I/home/dfe/Archive/boost_1_44_0 -L/home/dfe/Archive/boost_1_44_0/stage/lib yourprogram.cpp

-I option Adds dir to the list of directories that are searched for #include files.

-L option adds dir to the list of directories searched for libraries by linker

CC is sun compiler...

jRJ
  • 268
  • 2
  • 5
  • 1
    Yay! It worked! Thanks! Although my intention was to have the old version of Boost completely replaced by the new version. Right now, the files in /usr/include/boost/ seem to have got updated, but it's annoying to keep linking to the /home/dfe/Archive/boost_1_44_0 folder in every program that I use. Anything I can do to make 1_44_0 the default version? – Nav Nov 08 '10 at 12:27
11

First, I removed the existing boost rpm using

rpm -e boost-1.33.1-10.el5

A message is displayed saying "error: "boost" specifies multiple packages"

Then tried:

rpm -e --allmatches boost

(I don't remember whether I typed 'boost' or 'boost-1.33.1-10.el5')

The packages with dependencies were shown. I did:

rpm -e [packagename1]
rpm -e [packagename2]

and so on and then did:

rpm -e --allmatches

This erased boost completely from my system.

Then I extracted boost_1_44_0.tar.bz2 using tar -xvjf boost_1_44_0.tar.bz2 and ran bootstrap with:

./bootstrap.sh

Then ran bjam as:

./bjam install

That's it! Boost got installed on my system, and I didn't have to specify any of the linker options while compiling programs! Yay! Now the 'rpm -q boost' command shows that there is no package installed.

Nav
  • 19,885
  • 27
  • 92
  • 135
  • 4
    The key thing here is ./bjam install, because the instructions make it seem like ./b2 is the command to use to install. – node ninja Mar 16 '14 at 14:37
  • On the use of `./b2` vs `./bjam`: http://www.boost.org/build/doc/html/bbv2/faq/names.html – digawp Nov 16 '15 at 08:34