b2 vs bjam for building Boost library

Aniruth picture Aniruth · Jul 11, 2015 · Viewed 9.5k times · Source

I built Boost for VS2013, 64-bit architecture using both b2.exe and bjam.exe. According to Boost documentation, b2 must be used over bjam. The differences I notice are:

  1. The size of .lib files from b2 differs from that of the respective bjam file.
  2. Using bjam provides dynamic .lib libraries (without -s tag as mentioned here), but it doesn't provide the .dll files to link to (so what to do now?), whereas using b2 gives both static and dynamic libraries along with the .dll files. But the problem using b2 is, it gives two dynamic .lib files - one starts with boost_xxxx.lib and other with libboost_xxxx.lib and both are of different sizes. Why is that?

Also I mentioned different build directory using the build option --build-dir, but what is the use of this directory? It consists of .obj, .rsp along with respective .dll and .lib files. Can this directory be deleted?

Here are the commands I used to build Boost:

  1. b2:

    b2 toolset=msvc-12.0 --build-type=complete architecture=x86 address-model=32 install --build-dir=<build-dir> stage --stagedir=<stage-dir> -j2
    
  2. bjam:

    bjam stage --stagedir=<stage-dir>
    

Answer

yeoman picture yeoman · Jul 9, 2019

b2 and bjam are identical files except for their names. The different results are a consequence of calling them with different arguments.

About the preferred name: calling ./b2 --help and ./bjam --help both yield the name b2.