Boost logo

Boost :

Subject: [boost] [all] Request for out of the box visibility support
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2018-08-17 06:21:18

I'd like to draw attention to a problem with Boost binaries for Linux.

There's an awesome -fvisibility=hidden flag for Linux compilers that
improves load times, performance, size of binaries and reduces the
chance of symbol collisions. More info at .

Unfortunately, most of the Boost libraries do not set it by default:
- atomic
- chrono
- container
- context
- contract
- coroutine
- date_time
- exception
- fiber
- filesystem
- graph
- graph_parallel
- iostreams
- locale
- mpi
- program_options
- python
- random
- regex
- signals
- system
- test
- thread
- timer
- type_erasure
- wave

Moreover minority of the above libraries just do not work with the
flag. Users just can not run ./b2 cxxflags="-fvisibility=hidden"
because there's a chance that some library could stop linking.
Actually things are even more ugly. Linux distributions usually do not
tune the build flags for each package so at least Debian based
distributions build Boost with default flags. Users get suboptimal

If you're a maintainer of one of the above libraries *please do* the
following steps:
* Make sure that all the public symbols are accordingly marked with
appropriate BOOST_SYMBOL_* macro. Instruction is available here:
* Turn on the visibility=hidden by default:
    * by adding <target-os>linux:<cxxflags>"-fvisibility=hidden" to
the Jamfile if you do not care much for antique compilers (Example
    * by using a more advanced technique for detecting the flag
availability (For example see or )

P.S.: I would appreciate any comments or updates on the feature request.
P.P.S.: Log, Math, Serialization (and Stacktrace) libraries already
use that flag by default. Many thanks!

Best regards,
Antony Polukhin

Boost list run by bdawes at, gregod at, cpdaniel at, john at