Boost logo

Boost-Build :

Subject: Re: [Boost-build] Locating libraries
From: Brian Ravnsgaard Riis (brian_at_[hidden])
Date: 2012-01-05 19:35:45

Hash: SHA1

On 05-01-2012 16:27, Mateusz Loskot wrote:
> I have been trying to figure out how to achive such thing myself.
> And for some reasons I failed, so I moved myself from Boost.Build
> to...CMake (though, I'd not advocate for CMake against Boost.Build
> :))
> However, what I found useful is Boost Build Extensions project
> announced by Volodya some time ago:

Yes, I am familiar with this part of the sandbox (which I stumbled
upon quite by accident several years ago). The build_extensions
project is designed to allow building of software packages that do not
use BB as a part of your own software build process. This is very
nice, and besides this project taught me *a lot* about the internals
of b2. (Trying to "reverse engineer" extensions.jam and wxwidgets.jam
in order to simply figure out what is going on is a great way to
learn, if occassionally somewhat painful.)

> I used these extensions during Boost.GIL review to manage
> dependencies of raster libraries like libpng, etc. Here you can
> find some of my notes:
> If anyone knows a better approach than Boost.Build extensions, I'd
> love to hear.

I think the b2 extensions project (or something like it) is quite good
for projects that do not use b2. We then need a repository of jamfiles
corresponding to a wide set of software projects: zlib, png, jpeg,
pango, freetype, wxWidgets, you-name-it.

Unfortunately, since these are for projects that do *not* use b2
internally, someone needs to keep the jamfiles in this repository

But what about pre-built libs? A given piece of software may be quite
able to compile and run without, say, freetype or pango, but take
advantage of these libraries if they are present. If b2 could
determine whether they are available it could configure that build

Even better, it might be possible to have b2 locate headers and
libraries (or even complete software packages) given some standard
locations (and some supplied non-standard?) to search for the files
in. This is what CMake's FIND_PATH and FIND_LIBRARY commands do.

Just thinking out loud here...

A couple of problems/issues I see could be that the library is already
defined when we start looking for it. Say there is a site-config.jam
containing (from the manual):

    lib z ;
    lib png : z : <name>png ;

A given "find-library z" (or whatever the syntax might be) should then
return immediately since it's already defined, no? But is it possible
to determine in b2 that a given target has already been defined? And
how should it return success or failure? I would assume that if it
found zlib it would define z appropriately (tacking on the appropriate
<include> and <searched-lib> properties), but how to report that it
did not find it? As per above it can't simply stop the build process,
because we /might/ be able to continue regardless (possibly emitting a

Is any of all this at all possible in b2 at Jamfile level? How about
at python-level, if using a python port. Or does b2 itself (bjam) need
to be modified (I really should hope not!)...

I think I'm going back to think a bit more... If anyone who knows more
about b2 internals could give a hint as to whether this is even

Thanks for the blog-links, Mateusz. I hadn't read those before; it's
always illuminating to see how others tackle a project.

Version: GnuPG v2.0.12 (MingW32)
Comment: Using GnuPG with Mozilla -


Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at