1

I want to use boost lib for boost interprocess, Logger, JSON and XML parsing by considering cross platform application. I see total boost headers size is around 126 MB and after building boost libraries which comes around 156 MB. So total (126 + 156 = 282 MB). I feel this is little heavy for my system. Does boost support selective components so that I only require to build libraries for Interprocess, JSON and XML parsing. In other way, how to reduce the library size ?

GUI-Novice
  • 351
  • 5
  • 17
  • nope; lots of people want that, lots of people working on it, but won't be available before C++20. – user14717 Aug 13 '20 at 12:51
  • @user14717 I think you're wrong. Also, what change in c++20 are you referring to? (modules?) – sehe Aug 13 '20 at 13:22
  • @sehe: Yes, module support. Goal is to have independent packages for each library. See [here](https://github.com/boostorg/math/issues/263) for more background of our goals. – user14717 Aug 13 '20 at 13:55
  • @user14717 Got it. I wouldn't expect Boost to immediately adopt modules (just look at how long c++11 integration has been taking). Also, it would not fundamentally change much unless it also sees integration with distribution package management – sehe Aug 13 '20 at 15:48
  • @sehe: Yup, that's exactly right; the current task is to figure out how to build a C++20 module without breaking C++11 support. Probably gonna be a bit ugly. – user14717 Aug 13 '20 at 16:54

1 Answers1

1

In practice I have not seen overly large binaries from using these libraries you named. (Disclaimer: I don't use Boost Log in production so I might be surprised there).

More importantly: DO NOT use Boost for your JSON or XML needs. You /may/ use them for Property Tree needs, but Boost does NOT have XML or JSON support. Because of the way you phrased your question it looks to me like you were not aware of the severe limitations on JSON/XML that are being imposed by Property Tree (see e.g. Parsing XML's with Boost PTree w/o tags).

Most of the libraries you are mentioning are header only (or can be), except Boost Log. So you would only require Boost Log + dependencies. You can even configure some options to reduce the size of that: https://www.boost.org/doc/libs/1_73_0/libs/log/doc/html/log/installation/config.html. I think the suggested example

bjam --with-log variant=release define=BOOST_LOG_WITHOUT_EVENT_LOG define=BOOST_USE_WINAPI_VERSION=0x0600 stage

would already skip all non-header-only libraries not required. Of course, make sure you start from a clean staging directory to see the result.

Finally to potentially reduce the size of headers on disk, you could try your luck with BCP which exists for that reason. I wouldn't bother because it's extra work and complexity for no gain, IMO.

Some hints:

sehe
  • 374,641
  • 47
  • 450
  • 633