Boost logo

Boost Users :

Subject: Re: [Boost-users] It is possible to build a static version of boost for the MACOS
From: Rush Manbert (rush_at_[hidden])
Date: 2008-10-07 13:18:52

On Oct 7, 2008, at 5:37 AM, katherine Maguire wrote:

> Hi
> There seems to be bug with boost 1.36.0 and the bjam 03.1.16, as if
> you use link=static,shared then the shared libraries overwrite the
> static versions.
> When I include libboost_thread-mt.a in my project build with the
> above command, my application requires the libboost_thread-mt.dylib.

Hi Katherine,

I should have mentioned this before...

When we build both library variants, we always copy the dylibs out to
a separate directory. When we link our apps, we only provide the
directory that contains the static libs as a library search path.

The problem is that on the Mac the linker preferentially links
libfoo.dylib over libfoo.a when you specify the linker command -lfoo
and both libraries are on the library search path. The easiest way
around that problem is to either rename your dylibs, something like
libfoo.a and libfoo_d.dylib, or to segregate them in a different
directory. (I think that there is also another linker option that you
can use to force linking against the static libs, but I opted for the
brute force "move the dylibs" approach. You might search the Apple
Xcode Users mailing list for information about that approach.)

- Rush


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at