Why does bcp compute such a large list of dependencies for Boost program_options?

I am writing a small program using boost/program_options to process parameters from the command line. Now I want to distribute my code on systems where Boost is not installed at all. Therefore, I used the bcp utility. I tried this with a Boost example/first.cpp called example/first.cpp from the program_options tutorial :

 bcp --scan --boost=/users2/xxx/boost_1_45_0 ~/prova/first.cpp dest 

Creates a dest directory with tons of .hpp and .cpp files. I suppose this is what I need, and no more. Right? Because:

 du -hs dest 37M dest 

Is it too 37M? For example, I can do the same using Python with test_optparse.py with only test_optparse.py .

Am I doing something wrong? The fact is that my source program is only 4 MB; I can’t add 37 MB of third-party stuff !!

+4
source share
1 answer

Boost.Documentation contains more explanation on this topic than I can provide. Most noticeably:

It should be noted that in practice bcp can create a rather β€œthick” list of dependencies, the reasons for this include:

[...]

  • When you include the header, bcp does not know which compiler you are using, so it follows all possible preprocessor paths. If you are distributing a subset of Boost with you application, then this is what you want to happen as a whole.

The last paragraph above can lead to a significant increase in the number of headings found compared to the expectations of most people. For example, bcp finds 274 header dependencies for boost / shared_ptr.hpp: by running bcp in report mode, we see why all these headers were found as dependencies

I suggest you try bcp --report and check the reason for including each file to see if it is really necessary.

+3
source

Source: https://habr.com/ru/post/1333470/


All Articles