tags:

views:

1317

answers:

10

Boost is meant to be the standard non-standard C++ library that every C++ user can use. Is it reasonable to assume it's available for an open source C++ project, or is it a large dependency too far?

+3  A: 

I would say yes. Both Mandriva (Red Hat based) and Ubuntu (Debian based) have packages for the Boost libriaries.

J.J.
yes I noticed it was packaged (and on for example MacPorts) but it's rather large. some other people have answered that that it's had complaints
dajobe
A: 

Unfortunately yes, for ubuntu they're readily available but for RHEL 4&5 I've almost always ended up making them from tarballs. They're great libraries, just really big... like using a rail spike when sometimes all you really need is a thumbtack.

David
A: 

KDE also depends on Boost.

However it mostly depends on your goals, and even more so on your target audience, rather than the scope of your project. for example TinyJSON (very small project), is almost 100% Boost, but thats fine because the API it provides is Boost-like and targeted at Boost programmers that need JSON bindings. However many other JSON libraries don't use Boost because they target other audiences.

On the other hand I can't use Boost at work, and I know lots of other developers (in their day jobs) are in the same boat. So I guess you could say if your Target is OpenSource, and a group that uses Boost, go ahead. If you target enterprise you might want to think it over and copy-paste just the necessary parts from Boost(and commit to their support) for your project to work.

  • Edit: The reason we can't use it at work is because our software has to be portable to about 7 different platforms and across 4 compilers. So we can't use boost because it hasn't been proven to be compatible with all our targets, so the reason is a technical one. (We're fine with the OpenSource and Boost License part, as we use Boost for other things at times)
Robert Gould
I'm curious why you couldn't use it at work, fear of open source risks? Or some more technical reason?
dajobe
I thought that boost was regularly tested on like 12 systems and 10212 compilers?(Exaggeration of course). But I know they do a lot of testing on a lot of systems.
Raindog
Yes Boost works great on most platforms, but for critical embedded devices (such as military and medical), and many games machines(my case) there is no assurance that it will work correctly (and there are cases that its broken on some platforms).
Robert Gould
+9  A: 

I used to be extremely wary of introducing dependencies to systems, but now I find that dependencies are not a big deal. Modern operating systems come with package managers that can often automatically resolve dependencies or, at least,make it very easy for administrators to install what is needed. For instance, Boost is available under Gentoo-Postage as dev-libs/boost and under FreeBSD ports as devel/boost.

Modern open source software builds a lot on other systems. In a recent study, by tracking the dependencies of the FreeBSD packages, we established that the 12,357 ports packages in our FreeBSD 4.11 system, had in total 21,135 library dependencies; i.e., they required a library, other than the 52 libraries that are part of the base system, in order to compile. The library dependencies comprised 688 different libraries, while the number of different external libraries used by a single project varied between 1 and 38, with a mode value of 2. Furthermore, 5,117 projects used at least one external library and 405 projects used 10 or more.

In the end the answer to your question will come from a cost versus benefit analysis. Is the benefit of re-using a mature, widely used, reviewed, and tested library like Boost and larger than the low and falling cost of a dependency? For any non-trivial use of Boost's facilities the answer is that you should go ahead and use Boost.

Diomidis Spinellis
+3  A: 

It depends. If you're using a header file only defined class template in Boost - then yes go ahead and use it because it doesn't suck in any Boost shared library, as all the code is generated at compile time with no external dependencies. Versioning problems are a pain for any shared c++ library, and Boost is not immune from this, so if you can avoid the problem altogether it's a good thing.

+15  A: 
Subtwo
+24  A: 

Basically, in the extreme, your question boils down to “is it reasonable to have [free library xyz] as a dependency for a C++ open source project.”

Now consider the following quote from Stroustrup and the answer is really a no-brainer:

Without a good library, most interesting tasks are hard to do in C++; but given a good library, almost any task can be made easy

Assuming that this is correct (and in my experience, it is) then writing a reasonably-sized C++ project without dependencies is downright unreasonable.

Developing this argument further, the one C++ dependency (apart from system libraries) that can reasonably be expected on a (developer's) client system is the Boost libraries. I know that they aren't but it's not an unreasonable presumption for a software to make.

If a software can't even rely on Boost, it can't rely on any library.

Konrad Rudolph
A: 

It all depends on the way you're going to use Boost. As Diomidis said, if you're going to use some non-trivial facilities from Boost, just go ahead. Using libraries is not a crime.

Of course, there are many people who prefer not to use Boost, because introducing new dependencies has always some cons and extra worries, but in an open source project... in my opinion it's even alright to use them if you just want to learn them or improve your skills on them.

David Alfonso
+2  A: 

I think the extensive functionality that Boost provides and, as you say, it is the standard non-standard C++ library justifies it as a dependency.

Drew Stephens
+2  A: 

The benefits of using boost when writing C++ code that they significantly outweigh the extra complexity of distributing the open source code.

I work on Programmer's Notepad and the code takes a dependency on boost for test, smart pointers, and python integration. There have been a couple of complaints due to the requirement, but most will just get on with it if they want to work on the code. Taking the boost dependency was a decision I have never regretted.

To make the complexity slightly less for others, I include versioned pre-built libraries for boost python so that all they need to do is provide boost in their include directories.

Simon Steele
Yes, smart pointers was where I started looking.
dajobe