Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-07-21 08:50:28

Hi Wieger,

> I seem to have a problem with combining static and shared linking of
> system libraries. I use the following command line:
> bjam --v2 gcc release link=static runtime-link=static
> In combination with the following jamfile fragment:
> exe dnavis :
> Main.cxx
> /site-config//fltk
> /site-config//xerces-c/<link>shared
> Two of the system libraries are not available as static libraries, so
> I require them to be linked dynamically. However, linking fails with
> the message that the GL library (one of the two) can not be found. On
> inspection of the linker commandline it seems that nothing is done to
> link with the shared version of the GL library, so this was bound to fail.
> Does anybody know what I should do to make this work.

Short answer -- this just won't work.

Long answer -- with gcc, if you link with a single shared library, you link to
shared libc. I was told (by binutils maintainer) that it's not possible to
override this behaviour. Prior versions of Boost.Build tried some tricks to
force static linking with runtime, and this worked with gcc 2.95, but broke
with 3.* and at the time I was told it's simply impossible.

Further, the -static option does not mean "please link to static libraries
when possible". The linker has an option to *prefer* shared libraries to
static, and at option to *prevent* linking to shared libraries, but no option
to *prefer* static libraries. And -static translates in "no shared

I don't find this situation satisfactory, say in your case you just don't have
a static version of a library. However, it's binutils problem. I'd be happy
to be proved wrong -- do you know a command line that works?

- Volodya


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