0

I have a C++ project that I share with some colleagues. The development operating systems are different among us, usually divided between MacOS and different Linux distros.

We already use different libraries, that we use to paste in the lib folder and they are ready to use for us.

We need to use Boost and, for some reason, it looks like the way it works is different by other libraries and it needs to be installed on the system, like this question asks.

It looks like that installing Boost on the system is a de-facto standard, and many people give it for granted, even if I didn't see any reference to it and I don't see any good reason to do it, since it makes the source code less portable because of external dependencies and different IDE configurations. While having an IDE-independent configuration would actually make more sense.

So what are the advantages of one way over the other?

  • Boost is C++ to the core and highly dependent on the tools used to compile it. With a canned library, a subtle difference to, say, `std::string` between your tools and the tools used to build the library will result in hard-to-solve errors. Unless you've swapped out your compiler, the package manager make sure you get a matching boost. – user4581301 Sep 14 '20 at 17:43

2 Answers2

2

What's the difference between installing boost on the system and paste it locally in the project?

If you install a library on the system, then it will be found from the default include / library archive directories, and the compiler / build system will find the library without special configuration. If you install a library elsewhere, then you need to configure the compiler / build system to find the headers and the archives from where you've copied them.

The way to install library can vary across different systems.

it looks like the way [Boost] works is different by other libraries and it needs to be installed on the system

No, Boost is not special in this regard. It can be installed in a system directory, and elsewhere.


Regardless of where you install the library, I recommend using a package manager.

If you install using the system package manager, then you will be limited to the version provided by the system. This is an advantage when targeting that particular system, but a potential problem when developers use a variety of systems.

eerorika
  • 232,697
  • 12
  • 197
  • 326
1

A system package is often better because it is adapted to the specific environment of the given system by the packager. Moreover, using a system package means the application is more likely to work correctly on users’ systems because then you can package it, getting the runtime library as a dependency.