(Editor’s note: see the wiki for a more structured and updated version…)

I wrote an object-oriented database a few years back using “C++ Database Development” from Al Stevens as inspiration, and I’ve always wanted to dig it out and get it updated. I’m also working on ShareTheDJ, which needs cross-platform object serialization. Robert Ramey implemented boost::serialization and it looks like an excellent way to serialize my objects in a more STL-friendly way. Here’s how to set up under FC3/FC4, gentoo and Windoze…

UPDATE: Sourceforge root changed from [cvs-pserver.sf.net:443] to [boost.cvs.sourceforge.net]. Instructions were updated.

The following instructs you on how to obtain and build the latest boost code from the CVS repository, and set up boost and the boost::serialize library for development under Windows, Fedora FC3/FC4, and gentoo.


Gentoo/Fedora FC4/FC5 + gcc

  • cd #your_development_dir#
  • mkdir boost_cvs
  • cd boost_cvs
  • mkdir bjam
  • Get and unpack the bjam linux executable into the bjam dir.
  • cd back to the boost_cvs dir.
  • Get boost from CVS:
    cvs -d:pserver:[email protected]/cvsroot/boost login
    cvs -z3 -d:pserver:[email protected]/cvsroot/boost co -P boost
  • The above step should have created a boost dir, cd into it (boost_cvs/boost).
  • ../bjam/boost-jam-#version#-linuxx86/bjam “-sTOOLS=gcc”
  • Go get lunch.
  • su –
  • cd boost_cvs/boost
  • ../bjam/boost-jam-#version#-linuxx86/bjam “-sTOOLS=gcc” install
  • I made the following changes to my automake project:
    configure.in: CPPFLAGS=”${CPPFLAGS} -I/usr/local/include/boost-#version#”
    Makefile.am: yourproject_LDADD = (…) /usr/local/lib/libboost_serialization-gcc.aNow you should be good to go! Grab some sample code and have at it.


    VC 7.1

  • To get to CVS under Windows with TortoiseCVS:
    Right-click in the directory where you want boost, and select “Checkout…”
    Protocol = :pserver:
    Server = boost.cvs.sourceforge.net
    Port = default
    Repository folder = /cvsroot/boost
    User name = anonymous
    Module = boost
  • IF THAT FAILS, you may have a firewall in the way, try this instead…
  • Download the boost make util, bjam, for Windows
  • Put bjam.exe in your path.
  • cd #your_checkout_dir#\\boost
  • vcvars32.bat (WARNING: use the right one, if VC6 is installed you usually get the wrong one…)
  • bjam “-sTOOLS=vc-7_1” stage
    …updated 1123 targets…
  • add #yourcheckoutdir#\\boost to your VC++ include directories
  • add #yourcheckoutdir#\\boost\\stage\\lib to your VC++ lib directories
  • The boost developers have done a LOT of work in getting everything working well on my favorite compilers, gcc and VC++, so no complaints from me. At the same time, boost docs claim that boost libraries can be linked automatically for you under Windows, and they often will, but if you read the serialize fine print…

    Automatic linking support will be introduced in a future release.

    So we need to manually include the serialize library in our VC++ project. With a little experimentation, here’s my guesses at what to use:

  • DYNAMICALLY LINKED C RUNTIME LIBRARY

    • Multi-threaded (MT): libboost_serialization-vc71-mt.lib
    • MT debug: libboost_serialization-vc71-mt-gd.lib

    STATICALLY LINKED C RUNTIME LIBRARY

    • MT: libboost_serialization-vc71-mt-s.lib
    • MT debug: libboost_serialization-vc71-mt-sgd.lib
    • ST: libboost_serialization-vc71-s.lib
    • ST debug: libboost_serialization-vc71-sgd.lib
  • Just add the right library name to the project’s Properties->Linker->Input->Additional Dependencies for each configuration.
    Grab the sample code from the serialize docs. And off we go!
  • Leave a Reply