1

I was playing with the C++ Boost.Process library (v1.68) and am using cmake to compile.

I found it surprisingly difficult to know which cmake component (or even boost compiled library) a particular boost header/library requires. There are various similar Stackoverflow topics (some linked below), but most are very specific, fairly old, or end up in long discussions without really satisfying solution, and I am surprised that such a widely used collection of libs wouldn't have a simple section in the docs saying e.g. "Boost process requires X and Y" (or at least I could not find it).

I initially got tricked by boost listing Boost.Process as "header only". Same e.g. at https://stackoverflow.com/a/45946466/8224596. From what I can gather however, it seems to me that "header only" for boost only means "no additional code to compile apart from other boost components". I mistakenly thought the "Categories" in the boost lib list were an indicator to which libs they depend on, but that turns out to be wrong as well.

Thus question remains open... How do I know which compiled libraries a boost library depends on?

The only reliable solution I have found so far is a boost lib tool "bcp" (inspired by How to find out what dependencies (i.e other Boost libraries) a particular Boost library requires?). When I run bcp --list boost/process/child.hpp (which is the only header I use), I get a long list of files, ending with

[...]
boost/winapi/synchronization.hpp
boost/winapi/time.hpp boost/winapi/wait.hpp 
libs/filesystem/build/Jamfile.v2
libs/filesystem/src/codecvt_error_category.cpp
libs/filesystem/src/operations.cpp
libs/filesystem/src/path.cpp
libs/filesystem/src/path_traits.cpp
libs/filesystem/src/portability.cpp
libs/filesystem/src/unique_path.cpp
libs/filesystem/src/utf8_codecvt_facet.cpp
libs/filesystem/src/windows_file_codecvt.cpp
libs/filesystem/src/windows_file_codecvt.hpp
libs/system/build/Jamfile.v2
libs/system/src/error_code.cpp

This would indicate that there are some dependencies on the boost components filesystem and system (for my v.1.68, I believe this would be different for 1.69 since system is now header only according to the docs).

This works, but the original topic is 8 years old. Is there a better way to get information about dependencies than bcp (e.g. a doc page I missed...)?

I the worst case, I hope this may help someone else going through the same process.

Thanks!

Cedric
  • 278
  • 1
  • 9
  • @JohnZwinck The title of the section says "Header-Only", but the list are the "The only Boost libraries that must be built separately". – Cedric Feb 02 '21 at 10:56
  • 1
    https://pdimov.github.io/boostdep-report/boost-1.75.0/process.html – user7860670 Feb 02 '21 at 10:58
  • This question feels like a dupe of https://stackoverflow.com/questions/10818717/how-to-find-out-what-dependencies-i-e-other-boost-libraries-a-particular-boost - is there something different about what you're asking? – John Zwinck Feb 02 '21 at 10:59
  • @JohnZwinck : No, that's also why I linked that duplicate in my question (as well as the answer). But the topic is over 8 years old, and the answer to the original topic was rather short with "use bcp". – Cedric Feb 02 '21 at 11:04
  • 2
    I've posted a new answer suggesting using boost dep-report there. – user7860670 Feb 02 '21 at 11:07
  • @user7860670 : Thank you for the link! The dependency list does not seem to distinguish compiled from header-only ones though? E.g. `algorithm` and `asio` are not compiled boost libs, but are listed. On the other hand, `chrono` is listed in the "secondary dependencies" and is a compiled boost lib, but does not appear in the "libs" section of `bcp`? – Cedric Feb 02 '21 at 11:09
  • Well, separation into header-only and compiled libraries are rather vague. chrono is one of those that is compiled but can be partially used as a header-only library. I'm not sure to which *"libs" section of bcp* you are referring to. I think chrono should be listed as a primary dependency though. – user7860670 Feb 02 '21 at 11:29
  • @user7860670 : I see, thanks for the clarification. When running `bcp`, some files are placed under "boost", and others under a "libs" path (see original question). I'm assuming the "libs" section is the ones I cannot build "header only" (e.g. as `Boost::headers` in the cmake case). I found the source of my confusion in this case : `bcp --list boost/process` does indeed return `chrono` as well. I was calling it on `process/child.hpp` specifically, which must not depend on `chrono`. – Cedric Feb 02 '21 at 11:41

0 Answers0