Which Boost libraries are header-only?

C++Boost

C++ Problem Overview


Which Boost libraries are header-only? And which require building libraries?

Does such a list exist?

C++ Solutions


Solution 1 - C++

The list of libraries that require building is here for Unix-like systems, and here for Windows.

For the current release, 1.58, both are the same:

  • Boost.Chrono
  • Boost.Context
  • Boost.Filesystem
  • Boost.GraphParallel
  • Boost.IOStreams
  • Boost.Locale
  • Boost.MPI
  • Boost.ProgramOptions
  • Boost.Python
  • Boost.Regex
  • Boost.Serialization
  • Boost.Signals
  • Boost.System
  • Boost.Thread
  • Boost.Timer
  • Boost.Wave

A few libraries have optional separately-compiled binaries:

  • Boost.DateTime
  • Boost.Graph
  • Boost.Math
  • Boost.Random
  • Boost.Test
  • Boost.Exception

Note that some libraries may depend on these (for example, Asio depends on System as pointed out in the comments), so you may still need to build something even if the library you want isn't on the list.

Solution 2 - C++

Actually, even ./bootstrap.sh --show-libraries is somewhat incorrect too, because some libraries depend on that listed libraries.

It is possible to get list of header-only libraries with the Boost [BCP][1] tool, launching the tool on every library and removing those linking any binaries. That is what was done in [How To Build Header Only Boost][2].

For Boost 1.67.0 the resulting list was:

accumulators
align
any
array
assert
assign
bind
callable_traits
circular_buffer
compatibility
concept_check
config
container_hash
conversion
convert
core
crc
detail
disjoint_sets
dynamic_bitset
endian
foreach
format
function
functional
function_types
fusion
geometry
gil
hana
heap
hof
icl
integer
interprocess
intrusive
io
iterator
lambda
lexical_cast
locale
local_function
logic
metaparse
move
mp11
mpl
msm
multi_array
multi_index
optional
phoenix
poly_collection
polygon
predef
preprocessor
property_tree
proto
ptr_container
qvm
ratio
rational
scope_exit
signals2
smart_ptr
sort
static_assert
throw_exception
tokenizer
tti
tuple
type_index
typeof
type_traits
units
unordered
utility
uuid
variant
vmd
winapi
xpressive

[1]: https://www.boost.org/doc/libs/1_67_0/tools/bcp/doc/html/index.html "bcp" [2]: https://github.com/ki11roy/header_only_boost

Solution 3 - C++

I think the list above is not accurate even though it's from the official documentation. See https://svn.boost.org/trac10/ticket/13222

Instead you can query the list of libraries that need to be built:

>    ./bootstrap.sh --show-libraries

   The Boost libraries requiring separate building and installation are:

    atomic
    chrono
    container
    context
    coroutine
    date_time
    exception
    fiber
    filesystem
    graph
    graph_parallel
    iostreams
    locale
    log
    math
    metaparse
    mpi
    program_options
    python
    random
    regex
    serialization
    signals
    stacktrace
    system
    test
    thread
    timer
    type_erasure
    wave

Note: On Windows you have to call bootstrap.bat to build "b2" and then call b2 --show-libraries instead.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiondangerousdaveView Question on Stackoverflow
Solution 1 - C++Mike SeymourView Answer on Stackoverflow
Solution 2 - C++Andrew SelivanovView Answer on Stackoverflow
Solution 3 - C++DeclanView Answer on Stackoverflow