Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2006-07-07 01:22:04

On Wednesday 05 July 2006 01:15, Roland Schwarz wrote:
> Vladimir Prus wrote:
> > On Linux, you can't just link to static runtime. If your program links to
> > any dynamic library, it will require dynamic runtime.
> I might be wrong, but there is a "-static-libgcc" switch to gcc:
> From man page:
> -shared-libgcc
> -static-libgcc
> On systems that provide libgcc as a shared library, these options
> force the use of either the shared or static version respectively.
> If no shared version of libgcc was built when the compiler was con-
> figured, these options have no effect.

I might be wrong as well, but that only affects libgcc, which is a helper
library for exception handling and such. It does not affect libc, which is
the largest dependency, and less stable.

> AFAIK this is the equivalent of the msvc /MD /MDd for the shared
> runtime and /ML /MT ... for the static runtimes.
> But the <runtime-link>static for gcc is not translated to
> -static-libgcc (as I would guess), but to -static .

Right, because if you use -static-libgcc, you'll still get dynamic linking to

> -static has different sematics, as I think it is just to modfiy
> behaviour of the -l switch to prefer static over dynamic libraries
> to search for.

It's stricter -- with -l the linker won't link to dynamic library, ever.

I was told the problem with <runtime-link>static on Linux is that if you have
two dynamic libraries which are statically linked to libc, then you'll get
two copies of various important data, and that's no going to work.

IIRC, on windows two DLLS can actually statically link to runtime, and will
have different heaps, for example. I don't know why this does not work on

I'll try to check with someone who knows for sure, but this is likely to
result in more detailed explanation, not in a different one ;-)

> >> The problem now is with the "s" tag of the boost libraries:
> >> On windows this means I need to link with
> >> e.g. libboost_thread-vc71-mt-s.lib while on Linux
> >> libboost_thread-gcc-mt.a (without the "s")
> >
> > I'm sorry, I don't understand you. Can you explain?
> Say one writes a exe that has the /MT in its compiler switches. This
> e.g. is by putting <runtime-link>static in its requirements.
> Consequently on Windows I need to specify a boost library that has
> the -s- in its decorated name.
> On Linux with the same settings in the requirements section this will
> require me to link with a version that has no s in its decorated name.

Well, then I build program_options with
     bjam --v2 runtime-link=static link=static

I get


I would expect one should link to this one.

- Volodya

Vladimir Prus
Boost.Build V2:

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